6 Managing the lifecycle of the Pod’s containers
This chapter covers
- Inspecting the pod’s status
- Keeping containers healthy using liveness probes
- Using lifecycle hooks to perform actions at container startup and shutdown
- Understanding the complete lifecycle of the pod and its containers
After reading the previous chapter, you should be able to deploy, inspect and communicate with pods containing one or more containers. In this chapter, you’ll gain a much deeper understanding of how the pod and its containers operate.
6.1 Understanding the pod's status
After you create a pod object and it runs, you can see what’s going on with the pod by reading the pod object back from the API. As you’ve learned in chapter 4, the pod object manifest, as well as the manifests of most other kinds of objects, contain a section, which provides the status of the object. A pod’s status
section contains the following information:
- the IP addresses of the pod and the worker node that hosts it
- when the pod was started
- the pod’s quality-of-service (QoS) class
- what phase the pod is in,
- the conditions of the pod, and
- the state of its individual containers.
The IP addresses and the start time don’t need any further explanation, and the QoS class isn’t relevant now - you’ll learn about it in chapter 19. However, the phase and conditions of the pod, as well as the states of its containers are important for you to understand the pod lifecycle.