Core Track Guardrails-first chapter in core learning path.

Estimated Time

  • Reading: 30 min
  • Lab: 35 min
  • Quiz: 5 min

Prerequisites

What You Will Produce

On your own kind cluster: the platform’s apps read as numbers - their requests, limits and QoS class, what they really use, and how much of each namespace’s budget they take; then, in the namespace lab, a container killed with OOMKilled and kept so its reason can be read, a container throttled without a single event, a Deployment refused by the quota and a pod refused by the LimitRange. The lab ends with lab empty and every Kustomization Ready and none suspended.

Chapter 08: Resource Management & QoS

Learning Objectives

By the end of this chapter, you will be able to:

  • Explain what a request and a limit each do - for the scheduler, the quota and the kernel - and why CPU and memory behave differently at the limit
  • Name who stopped a container - the kernel’s OOM killer, the kubelet’s eviction, CPU throttling, the quota or the LimitRange - and where each one leaves its trace
  • Say what a QoS class decides and what it does not
  • Read the platform’s budget: the LimitRange and quota of each namespace, and the worst case check-app-resources.sh checks before a merge

Recall Check

Before continuing, quickly recall:

  • What does Flux do with a change made by hand in the cluster? (Chapter 03)
  • Which check runs every hook again on every pull request? (Chapter 05)
  • Pod Security refused a root pod - on the Deployment or on its pods, and where was the refusal visible? (Chapter 07)

If you can’t answer these, revisit the corresponding chapter before proceeding.

Context

Chapter 07 limited what a container may do. This chapter limits how much it may use.

Every pod on a node shares the same CPU and memory. Without numbers, the scheduler cannot know whether a pod fits, a node can be promised more than it has, and one container that keeps allocating takes memory from every pod next to it. Kubernetes asks two numbers of every container: a request - what the scheduler reserves for it on a node - and a limit - the ceiling the kernel holds it to. Each namespace adds two more rules: a LimitRange for each container and a ResourceQuota for the namespace’s total.

The numbers are not bureaucracy. They decide where a pod runs, which pod dies first when a node runs short, and whether a release with a memory leak takes down one pod - or the node. They also hide a trap: when something goes wrong, the quickest fix is always a bigger number. A higher limit, a bigger quota, a larger node - each makes the symptom go away for a while, and none of them asks why the container needed more.

The platform gives every app container explicit requests and limits, every namespace a LimitRange and a quota, and checks before each merge that the worst case still fits. This chapter shows what each of these does, where each refusal appears, and how to read the evidence before reaching for a bigger number.

Work through each lesson section; the chapter video, once it is published, gives the concept overview.

From the Pull Request to the Kernel

Diagram: pull request check-app-resources.sh the worst case fits the quota; admission LimitRange: defaults, min/max per container ResourceQuota: the namespace total; scheduler places the pod where its requests fit; the running container memory over the limit: OOMKilled CPU over the limit: throttled; the node runs short kubelet evicts pods, the most over their requests first

Detailed Lessons

Hands-On Materials

Labs, quizzes and runbooks for this chapter are free - sign in with your email, Google or GitHub to open them.

  • Lab: A Budget, Not a Guess Free · sign in
  • Quiz: Chapter 08 (Resource Management & QoS) Free · sign in