Pod deployment lifecycle¶
The Pod deployment lifecycle in Kubernetes refers to the sequence of states and transitions a Pod goes through from its initial creation to termination, managed primarily by the Deployment controller^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md].
Lifecycle States¶
The lifecycle of a Pod typically involves the following key states:
- Pending: The Pod has been accepted by the cluster, but the container images have not been created yet^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md].
- ContainerCreating: The system is pulling images and starting the container environment^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md].
- Running: The Pod is running and at least one container is still in operation^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md].
- Terminating: The Pod is in the process of shutting down and removing its resources^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md].
Termination Strategies¶
The specific path a Pod takes during an update or termination phase is determined by the spec.strategy configuration of the managing Deployment^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md].
Recreate Strategy¶
When using the Recreate strategy, the lifecycle involves a complete downtime for all existing Pods before new ones are created^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md]. In this scenario:
- All running Pods transition to the Terminating state simultaneously^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md].
- Only after all Pods are terminated do the new Pods enter the Pending and Running states^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md].
Rolling Update Strategy¶
The RollingUpdate strategy (which is the default) allows for a more gradual transition where new and old Pods coexist temporarily^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md]. In this scenario:
- New Pods are created and transition through Pending to Running based on the
maxSurgelimit^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md]. - Old Pods transition to Terminating based on the
maxUnavailablelimit^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md]. - This cycle repeats until all instances are running the new version^[400-devops-06-kubernetes-k8s-ithelp-day13-readme.md].
Related Concepts¶
- [[Deployment Strategies]]
- Kubernetes
Sources¶
400-devops-06-kubernetes-k8s-ithelp-day13-readme.md