chapter nine

9 Running Pods: how the kubelet works

 

This chapter covers

  • Learning what the kubelet does on a Node
  • Exploring how the kubelet is configured on a Node
  • Connecting container runtimes with the kubelet
  • Launching containers with the kubelet
  • Comprehending how the kubelet control the Pod lifecycle
  • Understanding the Container Runtime Interface
  • Walking through the go interfaces inside of the kubelet and CRI

As you know, the kubelet is the workhorse of a Kubernetes cluster, and there may be thousands of kubelets in a production data center.

In this chapter, we’ll go through the internals of what the kubelet does and precisely how the kubelet leverages the container runtime interface (CRI) to run containers and manage the lifecycle of workloads. One of the kubelet’s jobs is to start and stop containers, and CRI is a defined interface that the kubelet uses to interact with container runtimes. containerd, for example, is categorized as a container runtime, as it takes an image and creates a running container. Docker engine is another container runtime tool, but is now depreciated by the Kubernetes community, in favor of containerd, runC, or other runtimes.

[Note]  Note

We want to thank Dawn Chen for allowing us to interview her about the kubelet. Dawn is the original author of the kubelet binary and is currently one of the leads of the Kubernetes Node Special Interest Group. This group maintains the kubelet code base.

9.1 The kubelet and the Node

9.2 The core kubelet

9.2.1 Container runtimes: standards and conventions

9.2.2 The kubelet configurations and it’s API

9.3 Creating a Pod and seeing it in action

9.3.1 Starting the kubelet binary

9.3.2 After startup: Node lifecycle

9.3.3 Leasing and locking in etcd, and the evolution of the node-lease

9.3.4 the kubelet’s management of Pod lifecycle

9.3.5 CRI, Containers and images: How are they related?

9.3.6 The kubelet doesn’t run containers: that’s CRI’s job

9.3.7 Pause container: an “aha” moment

9.4 The Container Runtime Interface (CRI)

9.4.1 Two options tell Kubernetes where your container runtime lives

9.4.2 The CRI routines