Pod is stuck in CrashLoopBackOff mode
If a pod has a CrashLoopBackOff
status, then the pod probably failed or exited unexpectedly, and the log contains an exit code that isn't zero. There are several possible reasons why your pod is stuck in CrashLoopBackOff
mode. Consider the following options and their associated kubectl commands.
Option | kubectl command |
---|---|
Debug the pod itself | kubectl describe pod <pod-name> |
Debug the replication controllers | kubectl describe replicationcontroller <controller-name> |
Read the termination message | kubectl get pod <pod-name> --output=yaml |
Examine the logs | kubectl logs <pod-name> |
Note
A pod can also have a CrashLoopBackOff
status if it has finished deployment, but it's configured to keep restarting even if the exit code is zero. For example, if you deploy a busybox image without specifying any arguments, the image starts, runs, finishes, and then restarts in a loop:
$ kubectl run nginx --image nginx
pod/nginx created
$ kubectl run busybox --image busybox
pod/busybox created
$ kubectl get pods --watch
NAME READY STATUS RESTARTS AGE
busybox 0/1 ContainerCreating 0 3s
nginx 1/1 Running 0 11s
busybox 0/1 Completed 0 3s
busybox 0/1 Completed 1 4s
busybox 0/1 CrashLoopBackOff 1 5s
$ kubectl describe pod busybox
Name: busybox
Namespace: default
Priority: 0
Node: aks-nodepool<number>-<resource-group-hash-number>-vmss<number>/<ip-address-1>
Start Time: Wed, 16 Aug 2023 09:56:19 +0000
Labels: run=busybox
Annotations: <none>
Status: Running
IP: <ip-address-2>
IPs:
IP: <ip-address-2>
Containers:
busybox:
Container ID: containerd://<64-digit-hexadecimal-value-1>
Image: busybox
Image ID: docker.io/library/busybox@sha256:<64-digit-hexadecimal-value-2>
Port: <none>
Host Port: <none>
State: Waiting
Reason: CrashLoopBackOff
Last State: Terminated
Reason: Completed
Exit Code: 0
Started: Wed, 16 Aug 2023 09:56:37 +0000
Finished: Wed, 16 Aug 2023 09:56:37 +0000
Ready: False
Restart Count: 2
If you don't recognize the issue after you create more pods on the node, then run a pod on a single node to determine how many resources the pod actually uses.
Third-party information disclaimer
The third-party products that this article discusses are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, about the performance or reliability of these products.
Contact us for help
If you have questions or need help, create a support request, or ask Azure community support. You can also submit product feedback to Azure feedback community.