Understanding Pause Containers and Pod Disruptions in Kubernetes
About Pause container
It is a process in Kubernetes, which is associated with the container, a namespace holder, and a process manager that facilitates signal handling of the resources.
It holds the pod network namespace.
It is useful for pod lifecycle management.
If the container within the pod restarts the pod IP will remain the same.
Signal forwarding from one container to another container inside the pod.
The pod will be active even if its container was not active because the pause container was running.
About Pod disruptions
It was broadly divided into two categories:
Voluntary disruption:
It is the intentional termination of pods on nodes by application owners or cluster administrators.
Example:
- Updating a deployment's pod template
- Deleting deployment
- Draining node for repair or upgrade
- Deployment draining, etc.Involuntary disruption:
When pods on nodes are terminated due to unintentional events or failures.
Example:
- Node crashes
- Hardware failure
- A pod is evicted because the node is out of resources
- Kernel panic
- VM delete, etc.
Mitigation for involuntary disruption
Specify pod requests
More replicas for HA
Replicas with Anti-affinity
Pod disruption budget (PDB)
It helps maintain the availability of pods during voluntary disruptions. It limits the number of pods that can be down simultaneously.
Example: We have a deployment with 3 replicas with the PDB of 2 pods.
Case1:
Here, If we drain server A, then as per PDB it will allow eviction of 1 pod, hence it will create pod(P1) either in Server B or C depending upon the node capacity.
Case2:
Here, Server A was already drained, and now if we want to drain Server B & Server C is running at full capacity, then as per PDB it will evict only one pod but Server B has 2 pods, hence it will hold the node draining.
Sample configuration:
Github: https://github.com/minex970/kubernetes-overview/tree/main/pdb
Subscribe to my newsletter
Read articles from Neeraj Gupta directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by