<p>I have Question on pod termination on using image: kodekloud/throw-dice </p>

<p>pod-defintion.yml</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: throw-dice-pod
spec:
  containers:
  -  image: kodekloud/throw-dice
     name: throw-dice
  restartPolicy: Never
</code></pre>

<p>I have checked the steps in <a href="https://hub.docker.com/r/kodekloud/throw-dice/dockerfile" rel="nofollow noreferrer">DockerFile </a>. It runs <a href="https://github.com/kodekloudhub/throw-dice/blob/master/throw-dice.sh" rel="nofollow noreferrer">throw-dice.sh</a> which randomly returns number in between 1 - 6.</p>

<p>let's consider first time container return 3, so how below pod is terminated ? where is the condition defined in the pod level it suppose to terminate if script return number is !6.</p>

<p>Below steps were performed to execute pod-definition.yml</p>

<pre><code>master $ kubectl create -f /root/throw-dice-pod.yaml
pod/throw-dice-pod created
master $ kubectl get pods
NAME             READY   STATUS              RESTARTS   AGE
throw-dice-pod   0/1     ContainerCreating   0          9s
master $ kubectl get pods
NAME             READY   STATUS   RESTARTS   AGE
throw-dice-pod   0/1     Error    0          12s
master $ kubectl describe pod throw-dice-pod
Name:         throw-dice-pod
Namespace:    default
Priority:     0
Node:         node01/172.17.0.83
Start Time:   Sat, 16 May 2020 11:20:01 +0000
Labels:       &lt;none&gt;
Annotations:  &lt;none&gt;
Status:       Failed
IP:           10.88.0.4
IPs:
  IP:  10.88.0.4
Containers:
  throw-dice:
    Container ID:   docker://4560c794b58cf8f3e3fad691b2292e37db4e84e20c9286321f026d1735272b5f
    Image:          kodekloud/throw-dice
    Image ID:       docker-pullable://kodekloud/throw-dice@sha256:9c70a0f907b99293885a9591b6162e9ec89e127937626a97ca7f9f6be2d98b01
    Port:           &lt;none&gt;
    Host Port:      &lt;none&gt;
    State:          Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Sat, 16 May 2020 11:20:10 +0000
      Finished:     Sat, 16 May 2020 11:20:10 +0000
    Ready:          False
    Restart Count:  0
    Environment:    &lt;none&gt;
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-nr5kl (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  default-token-nr5kl:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-nr5kl
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  &lt;none&gt;
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type    Reason     Age        From               Message
  ----    ------     ----       ----               -------
  Normal  Scheduled  &lt;unknown&gt;  default-scheduler  Successfully assigned default/throw-dice-pod to node01
  Normal  Pulling    21s        kubelet, node01    Pulling image "kodekloud/throw-dice"
  Normal  Pulled     19s        kubelet, node01    Successfully pulled image "kodekloud/throw-dice"
  Normal  Created    19s        kubelet, node01    Created container throw-dice
  Normal  Started    18s        kubelet, node01    Started container throw-dice


 master $ kubectl logs throw-dice-pod
      2
</code></pre>

<p>The dockerfile has <code>ENTRYPOINT sh throw-dice.sh</code> which means execute the script and then the container terminates automatically. If you want the container to keep running you need to start a long running process for example a java process <code>ENTRYPOINT ["java", "-jar", "/whatever/your.jar"]</code></p>
