Mak*_*kin 0 kubernetes crashloopbackoff
Kubernetes 的默认设置是什么CrashLoopBackOff?
假设我有一个 pod:
kubectl run mynginx --image nginx -- echo hello
Run Code Online (Sandbox Code Playgroud)
我检查它的状态:
kubectl get pods -w
NAME READY STATUS RESTARTS AGE
mynginx 0/1 Pending 0 0s
mynginx 0/1 Pending 0 0s
mynginx 0/1 ContainerCreating 0 0s
mynginx 0/1 Completed 0 2s
mynginx 0/1 Completed 1 4s
mynginx 0/1 CrashLoopBackOff 1 5s
mynginx 0/1 Completed 2 20s
mynginx 0/1 CrashLoopBackOff 2 33s
mynginx 0/1 Completed 3 47s
mynginx 0/1 CrashLoopBackOff 3 59s
mynginx 0/1 Completed 4 97s
mynginx 0/1 CrashLoopBackOff 4 109s
Run Code Online (Sandbox Code Playgroud)
这是“预期”的。Kubernetes 启动一个 pod,它“太快”退出,Kubernetes 再次调度它,然后 Kubernetes 将状态设置为CrashLoopBackOff。
现在,如果我启动一个稍微不同的 Pod:
kubectl run mynginx3 --image nginx -- /bin/bash -c "sleep 10; echo hello"
Run Code Online (Sandbox Code Playgroud)
我得到以下内容
kubectl get pods -w
NAME READY STATUS RESTARTS AGE
mynginx3 0/1 Pending 0 0s
mynginx3 0/1 Pending 0 0s
mynginx3 0/1 ContainerCreating 0 0s
mynginx3 1/1 Running 0 2s
mynginx3 0/1 Completed 0 12s
mynginx3 1/1 Running 1 14s
mynginx3 0/1 Completed 1 24s
mynginx3 0/1 CrashLoopBackOff 1 36s
mynginx3 1/1 Running 2 38s
mynginx3 0/1 Completed 2 48s
mynginx3 0/1 CrashLoopBackOff 2 62s
mynginx3 1/1 Running 3 75s
mynginx3 0/1 Completed 3 85s
mynginx3 0/1 CrashLoopBackOff 3 96s
mynginx3 1/1 Running 4 2m14s
mynginx3 0/1 Completed 4 2m24s
mynginx3 0/1 CrashLoopBackOff 4 2m38s
Run Code Online (Sandbox Code Playgroud)
这也是预料之中的。
但是假设我设置为 24 小时,那么在最初两次 Pod 退出以及每次下一个 Pod 退出后,sleep我还会得到相同的结果吗?CrashLoopBackOff
| 归档时间: |
|
| 查看次数: |
3431 次 |
| 最近记录: |