<p><code>pod.yml</code></p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
    name: hello-pod
    labels:
        zone: prod
        version: v1
spec:
    containers:
    - name: hello-ctr
      image: hello-world:latest
      ports:
      - containerPort: 8080
</code></pre>

<p><code>kubectl create -f pod.yml</code></p>

<pre><code>kubectl get pods
NAME        READY     STATUS             RESTARTS   AGE
hello-pod   0/1       CrashLoopBackOff   5          5m
</code></pre>

<p>Why <code>CrashLoopBackOff</code>?</p>

<p>In this case the expected behavior is correct. The hello-world container is meant to print some messages and then exit after completion. So this is why you are getting <code>CrashLoopBackOff</code> - </p>

<p>Kubernetes runs a pod - the container inside runs the expected commands and then exits. </p>

<p>Suddenly there is nothing running underneath - so the pod is ran again -> same thing happens and the number of <code>restarts</code> grows.  </p>

<p>You can see that in<code>kubectl describe pod</code> where <code>Terminated</code> state is visible and the <code>Reason</code> for it is status <code>Completed</code>. If you would choose a container image which does not exit after completion the pod would be in running state. </p>
