A pod is the deployment unit for the Kubernetes. A pod is also having the life cycle just like the process in Linux. Pods are mortal i.e. pods can die and reborn. Each pod consists of a unique Id (UID) which is unique for the pod.
It consists of a single container or multiple containers that represent the single instance of the application. It may be an application container, web server, volume container or a batch job.
It’s always best practice to have one pod one container. If the application is tightly coupled then the pod can consists of multiple containers.
But managing multi-container pod is more complex in terms of network and storage space. Pod wraps the single container or multiple containers.
Kubernetes manages the pod. To create the Pod object with Kubernetes it’s required to have the specification for the Pod. The pod template gives these specifications. Pod Template is the YAML / JSON file with certain specifications that describes the desired state of the Pod.
The pod is having a life cycle like the Linux process. PodStatus object gives the status information of the Pod. It consists of the phase of the Pod. Phase indicates where the Pod lies in the lifecycle of the Pod.
Pod Phase consists:
Running: All the containers in the Pod are created and at least one container is in running, restarting or is in process of the starting. The pod is bounded with the Kubernetes cluster Node.
Pending: Pod is accepted by the Kubernetes system. All containers are not created. I.e. either Kubernetes scheduler is scheduling the pods on specific nodes or container images are still in the downloading phase. You can see a pending state when the container is downloading the images from the remote.
Succeeded: All containers in the Pod are terminated in success state. And those containers will not be restarted.
Failed: All containers in the Pod are terminated. Either one of the containers is terminated in failure. There may be a different reason for the failure termination of the containers. It may be terminated by the system or forcefully killed.
Unknown: State of the Pod could not be obtained.