6 Manging the Pod lifecycle

 

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.

Note

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.

6.1.1 Understanding the pod phase

6.1.2 Understanding pod conditions

6.1.3 Understanding the container status

6.2 Keeping containers healthy

6.2.1 Understanding container auto-restart

6.2.2 Checking the container’s health using liveness probes

6.2.3 Creating an HTTP GET liveness probe

6.2.4 Observing the liveness probe in action

6.2.5 Using the exec and the tcpSocket liveness probe types

6.2.6 Using a startup probe when an application is slow to start

6.2.7 Creating effective liveness probe handlers

6.3 Executing actions at container start-up and shutdown

6.3.1 Using post-start hooks to perform actions when the container starts

6.3.2 Using pre-stop hooks to run a process just before the container terminates

sitemap