Life Cycle of a Pod
Now that we know how to run a pod and how to configure it for our use cases, in this section, we will talk about the life cycle of a pod to understand how it works in more detail.
Phases of a Pod
Every pod has a pod status that tells us what stage of its life cycle a pod is in. We can see the pod status by running the kubectl get
command:
kubectl get pod
You will see the following response:
NAME READY STATUS RESTARTS AGE first-pod 1/1 Running 0 5m44s
For our first pod, named first-pod
, we see that the pod is in the Running
state.
Let's see what the different states that a pod can have in its life cycle are:
Pending
: This means that the pod has been submitted to the cluster, but the controller hasn't created all its containers yet. It may be downloading images or waiting for the pod to be scheduled on one of the cluster nodes.Running
: This state means that the...