【发布时间】:2020-10-29 09:53:51
【问题描述】:
奇怪的是,kubernetes 集群中的一个 pod 崩溃了,而另一个却没有!
codingjediweb-6d77f46b56-5mffg 0/1 CrashLoopBackOff 3 81s
codingjediweb-6d77f46b56-vcr8q 1/1 Running 0 81s
它们都应该具有相同的图像并且都应该工作。可能是什么原因?
我怀疑崩溃的吊舱有旧图像,但我不知道为什么。这是因为我修复了一个问题并希望代码能够正常工作(位于其中一个 pod 上)。
是否可能不同的 pod 有不同的图像?有没有办法检查哪个 pod 正在运行哪个映像?有没有办法“刷新”旧图像或强制 K8S 下载,即使它有缓存?
更新
在法门的建议下,我看了看图片。我可以看到崩溃的容器似乎正在使用现有的图像(可能是旧的)。如何让 K8S 始终拉取图片?
manuchadha25@cloudshell:~ (copper-frame-262317)$ kubectl get pods
NAME READY STATUS RESTARTS AGE
busybox 1/1 Running 1 2d1h
codingjediweb-6d77f46b56-5mffg 0/1 CrashLoopBackOff 10 29m
codingjediweb-6d77f46b56-vcr8q 1/1 Running 0 29m
manuchadha25@cloudshell:~ (copper-frame-262317)$ kubectl describe pod codingjediweb-6d77f46b56-vcr8q | grep image
Normal Pulling 29m kubelet, gke-codingjediweb-cluste-default-pool-69be8339-wtjt Pulling image "docker.io/manuchadha25/codingjediweb:08072020v3"
Normal Pulled 29m kubelet, gke-codingjediweb-cluste-default-pool-69be8339-wtjt Successfully pulled image "docker.io/manuchadha25/codingjediweb:08072020v3"
manuchadha25@cloudshell:~ (copper-frame-262317)$ kubectl describe pod codingjediweb-6d77f46b56-5mffg | grep image
Normal Pulled 28m (x5 over 30m) kubelet, gke-codingjediweb-cluste-default-pool-69be8339-p5hx Container image "docker.io/manuchadha25/codingjediweb:08072020v3" already present on machine
manuchadha25@cloudshell:~ (copper-frame-262317)$
此外,工作 pod 有两个镜像条目(拉取和拉取)。哪里有两个?
【问题讨论】:
标签: kubernetes google-kubernetes-engine