cancel
Showing results for 
Search instead for 
Did you mean: 
Kh4n
Cadet
Cadet
  • 257 Views

CrashLoopBackOff for Images from Docker hub

I ran the following in K8s sandbox:

kubectl run nginx --image=nginx

 

& see this when checking the pod status (using `kubectl get pods`)

NAME READY STATUS RESTARTS AGE
nginx 0/1 CrashLoopBackOff 1 (6s ago) 10s

 

kubectl describe output:

Name:                 nginx
Namespace:            user-dev
Priority:             -3
Priority Class Name:  sandbox-users-pods
Service Account:      default
Node:                 ip-10-0-13-47.ec2.internal/10.0.13.47
Start Time:           Mon, 23 Jun 2025 20:03:24 -0600
Labels:               run=nginx
Annotations:          k8s.ovn.org/pod-networks:
                        {"default":{"ip_addresses":["10.130.16.117/23"],"mac_address":"0a:58:0a:82:10:75","gateway_ips":["10.130.16.1"],"routes":[{"dest":"10.128....
                      k8s.v1.cni.cncf.io/network-status:
                        [{
                            "name": "ovn-kubernetes",
                            "interface": "eth0",
                            "ips": [
                                "10.130.16.117"
                            ],
                            "mac": "0a:58:0a:82:10:75",
                            "default": true,
                            "dns": {}
                        }]
                      kubernetes.io/limit-ranger: LimitRanger plugin set: cpu, memory request for container nginx; cpu, memory limit for container nginx
                      openshift.io/scc: restricted-v2
                      seccomp.security.alpha.kubernetes.io/pod: runtime/default
Status:               Running
SeccompProfile:       RuntimeDefault
IP:                   10.130.16.117
IPs:
  IP:  10.130.16.117
Containers:
  nginx:
    Container ID:   cri-o://2a4b4adf8bd9878a3012bb588fc7f5aa5efcb4f68facb32459fb88c03afb4499
    Image:          nginx
    Image ID:       docker.io/library/nginx@sha256:6784fb0834aa7dbbe12e3d7471e69c290df3e6ba810dc38b34ae33d3c1c05f7d
    Port:           <none>
    Host Port:      <none>
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Mon, 23 Jun 2025 20:04:17 -0600
      Finished:     Mon, 23 Jun 2025 20:04:17 -0600
    Ready:          False
    Restart Count:  3
    Limits:
      cpu:     1
      memory:  1000Mi
    Requests:
      cpu:        10m
      memory:     64Mi
    Environment:  <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-bb5jz (ro)
Conditions:
  Type                        Status
  PodReadyToStartContainers   True
  Initialized                 True
  Ready                       False
  ContainersReady             False
  PodScheduled                True
Volumes:
  kube-api-access-bb5jz:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
    ConfigMapName:           openshift-service-ca.crt
    ConfigMapOptional:       <nil>
QoS Class:                   Burstable
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/memory-pressure:NoSchedule op=Exists
                             node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason          Age                 From               Message
  ----     ------          ----                ----               -------
  Normal   Scheduled       107s                default-scheduler  Successfully assigned user-dev/nginx to ip-10-0-13-47.ec2.internal
  Normal   AddedInterface  107s                multus             Add eth0 [10.130.16.117/23] from ovn-kubernetes
  Normal   Pulled          106s                kubelet            Successfully pulled image "nginx" in 1.364s (1.364s including waiting). Image size: 196619128 bytes.
  Normal   Pulled          104s                kubelet            Successfully pulled image "nginx" in 1.319s (1.319s including waiting). Image size: 196619128 bytes.
  Normal   Pulled          86s                 kubelet            Successfully pulled image "nginx" in 1.432s (1.432s including waiting). Image size: 196619128 bytes.
  Normal   Created         55s (x4 over 106s)  kubelet            Created container: nginx
  Normal   Started         55s (x4 over 106s)  kubelet            Started container nginx
  Normal   Pulled          55s                 kubelet            Successfully pulled image "nginx" in 1.265s (1.265s including waiting). Image size: 196619128 bytes.
  Warning  BackOff         16s (x8 over 103s)  kubelet            Back-off restarting failed container nginx in pod nginx_user-dev(dabc916f-37eb-4680-9316-18b433a18b2f)
  Normal   Pulling         2s (x5 over 107s)   kubelet            Pulling image "nginx"

 

What am I doing wrong?

1 Reply
Chetan_Tiwary_
Community Manager
Community Manager
  • 230 Views

@Kh4n Please refer this blog for more details on CrashLoopBackOff error in K8s : https://learn.redhat.com/t5/DO280-Red-Hat-OpenShift/CrashLoopBackOff-in-K8s/m-p/35221#M18 

CrashLoopBackOff is a Kubernetes state representing a restart loop that is happening in a Pod: a container in the Pod is started, but crashes and is then restarted, over and over again.

What does the logs and events say about this issue ?

Something like

kubectl get events --sort-by=.metadata.creationTimestamp

Do you have any LivenessProbe ? Any ports issue ?

Check for the logs of the crashed pod it will give some clue.

0 Kudos
Join the discussion
You must log in to join this conversation.