Table of Contents
Introduction
Pod is one of the most important object in Kubernetes and it consists of containers. Pod can contain one or more containers in it. Related containers are grouped into a single Pod. In the image below there are 2 pods. In the first pod we have mongodb, bank account opening application and bank money transfer application. In the second pod we have postgresql, credit card processing application and home loan application. The job of a Pod is to provide all the resources that are necessary for these containers to work. Resources can be Security management, Configuration management, Volumes to store data etc.
In the similar way we can have multiple pods according to the use case.
A good practice is to have a single container in a pod. There are multiple ways to create a pod, and we can replicate a single pod.
Pod Lifecycle
Pending – This is the first phase of a POD, as soon as you create the pod the status assigned is Pending. API Server present in the master node will look at the pod configuration and check if everything is correct, then it will create an entry in the etcd. After this it will ask the worker node to create a pod as requested. But, one or more container’s setup is still is process and is in the process of being ready.
Running – The Pods that we have created will be scheduled in one of the worker node in the cluster. When at least one container within the pod is running.
Succeeded – The pod has performed the task, all the containers within it have terminated successfully and they wont restart.
Failed – When every container within the pod has terminated, but one or more containers have exited with some failure code , in that case the pod will be in a failed state.
Unknown – If for some reason the pod status could not be fetched by the master node then the status is set as Unknown.
Leave a Reply