8 cgroups and systemd slices: Coevolved process management

 

This chapter covers:

  • Introducing cgroups and systemd concepts
  • The various dimensions of hierarchy used to create new cgroups
  • Some of the paradigms that face the evolution of the container runtime interface for Kubernetes.
  • How systemd and cgroups can be inspected in the real world, and how they intersect in day-to-day operations
  • How to use Kubernetes to schedule high-priority processes

Although Kubernetes itself has scheduling capabilities, these are no substitute for the most fundamental scheduler in the Linux operating system, Systemd. Systemd initializes the parent for all processes in your operating system (PID 1) and uses cgroups to restrict the amount of resources (CPU, RAM, etc.) that these programs, and their children, use.

The most infamous of all of these children is the pause container.

8.1  A quick example of life without cgroups

This whole chapter is about resources and isolation. The term Resource fencing refers to isolating the resources allocated to a process, which might be CPU, disk, memory. This isolating happens automatically in the cloud when you make a VM - the VM has virtual access to a limited amount of resources on a hypervisor. But what about for local processes on a single OS? At this level, you isolate one program from another with cgroups.

Let’s look at what you can do without any resource fencing. For example, if you run:

8.2  Linux namespaces and cgroups

8.3  How this relates to Kubernetes

8.3.1   cgroups tell us the true nature of a Pod

8.3.2  Systemd provides us with insight into container management

8.4  Pods and cgroups

8.4.1  We told you! cgroups are hierarchical

8.5  cgroups and security

8.6  Allocatable resources

8.6.1  Linux namespaces

8.7  cgroups and Kubernetes in detail

Memory

8.7.1  Huge pages

8.7.2  CPU limits

8.7.3  QoS classes: Why they matter, and how they work

8.7.4  A note about process hierarchies

8.7.5  The Role of Systemd Notify Services in a Kubernetes Cluster