Kubernetes pod状态出现CrashLoopBackOff 的原因

做个实验:

$ kubectl run crasher --image=rosskukulinski/crashing-app

查看这个pod的状态:

$ kubectl get pods
NAME READY STATUS RESTARTS AGE
crasher-2443551393-vuehs 0/1 CrashLoopBackOff 2 54s

CrashLoopBackOff的含义是,Kubernetes试图启动该Pod,但是过程中出现错误,导致容器启动失败或者正在被删除。

用describe命令查看明细:

$ kubectl describe pod crasher-2443551393-vuehs
Name: crasher-2443551393-vuehs
Namespace: fail
Node: gke-nrhk-1-default-pool-a101b974-wfp7/10.142.0.2
Start Time: Fri, 10 Feb 2019 14:20:29 -0500
Labels: pod-template-hash=2443551393
run=crasher
Status: Running
IP: 10.0.0.74
Controllers: ReplicaSet/crasher-2443551393
Containers:
crasher:
Container ID: docker://51c940ab32016e6d6b5ed28075357661fef3282cb3569117b0f815a199d01c60
Image: rosskukulinski/crashing-app
Image ID: docker://sha256:cf7452191b34d7797a07403d47a1ccf5254741d4bb356577b8a5de40864653a5
Port:
State: Terminated
Reason: Error
Exit Code: 1
Started: Fri, 10 Feb 2017 14:22:24 -0500
Finished: Fri, 10 Feb 2017 14:22:26 -0500
Last State: Terminated
Reason: Error
Exit Code: 1
Started: Fri, 10 Feb 2017 14:21:39 -0500
Finished: Fri, 10 Feb 2017 14:21:40 -0500
Ready: False
Restart Count: 4

Pod状态变为Terminated,Exit Code 是 1。

查看应用日志:

$ kubectl logs crasher-2443551393-vuehs

查看前一个容器:
$ kubectl logs crasher-2443551393-vuehs --previous
Kubernetes pod状态出现CrashLoopBackOff 的原因_第1张图片
要获取更多Jerry的原创文章,请关注公众号"汪子熙":

Kubernetes pod状态出现CrashLoopBackOff 的原因_第2张图片

你可能感兴趣的:(Kubernetes)