A Kubernetes pod is the smallest building block. A pod represents a process that is running within a cluster. Within that pod, there can be one or more containers and inside that single pod you can find a unique network IP, network, storage and any extra specifications you’ve applied to it. For instance, think of your pod as an application-specific logical host. It can hold tightly coupled containers. In a time before containers, being executed on the same physical or virtual machine would mean existing on the same logical host.
Certainly, as Kubernetes continues to become the new standard for deployment and management of software in the cloud it’s important to understand the role of the software. Today we will be reviewing the types and lifecycle phases of Kubernetes pods. Let’s walk through it.
Kubernetes Pod Model Types
There are two types of pods that you can create within Kubernetes.
The first, one container per pod, is the most popular model. One container per pod is the smallest model type in Kubernetes so the pod is managed directly instead of through containers.
Meanwhile the second, a multi-container pod, can hold many co-located containers that are tightly coupled. This allows them to share resources amongst themselves. These containers then work as a cohesive unit together as one. A multi-container pod wraps these containers with storage resources into a single unit.
Moreover, as each pod runs a single instance of your application, you can use a pod to scale accordingly. You’re able to run multiple containers of the same application within one pod. It’s important to remember that pods are not created to be durable solutions. If a node fails your pod will not survive. Utilize controllers in Kubernetes to create a pod.
Kubernetes Pod Lifecycle Phases
As we mentioned, pods are not created to be permanent solutions. Keeping track of the status of your pod’s lifecycle can help you maintain and troubleshoot. It’s good practice to regularly debug your pod if its lifecycle doesn’t come up with ideal results.
The five phases of the Kubernetes pod lifecycle are:
- Pending: Congratulations, your pod has been accepted! One container image has not been created yet.
- Running: Your pod is now bound to a node and all containers are up and running. Your containers are running or in the process of restarting.
- Succeeded: Your containers within the pod have successfully terminated and they will not restart.
- Failed: All of your containers have terminated and at least one container is failing. Your failed container has exited with a non-zero status.
- Unknown: There is no information on the status of your pod.
Usually, pods remain until someone or an automated process explicitly removes them. A control plane will clean up Kubernetes pods with a lifecycle phase of ‘succeeded’ or ‘failed’. In short, this helps to avoid resource leaks as pods are created and terminated regularly.
Pods may be the smallest building block within Kubernetes but their usefulness is evident. If you’re looking to take full advantage of your cloud infrastructure, we at VEXXHOST are Certified Kubernetes and are here to help you through everything from deployment, management and more. Contact us today to learn more.