Skip to content

Chapter 6 of 8

Resource Management and Probes

Resource consumption in a Pod is governed by the distinction between requests and limits. Requests are the amount of a resource guaranteed to a container for scheduling purposes, while limits are the maximum amount the container is allowed to use and are enforced at runtime. When a container exceeds its memory limit, it is terminated with an OOMKilled exit status; for CPU, the container is throttled rather than killed. Together, requests and limits determine a Pod's Quality of Service (QoS) class, which in turn dictates its eviction priority under node pressure.

QoS classes are assigned as follows. Guaranteed applies when every container in the Pod has limits equal to requests for both CPU and memory. BestEffort applies when no container sets any requests or limits. Burstable covers every other configuration. Under node pressure, Pods are evicted in a predictable order: BestEffort first, then Burstable Pods that exceed their requests, then Burstable Pods within their requests, with Guaranteed Pods evicted last.

Kubernetes also uses probes to observe container health. A liveness probe determines when to restart a container: if the probe fails, the kubelet kills and restarts the container. A readiness probe determines whether a container is ready to receive traffic; Pods whose containers fail readiness are removed from Service endpoints until they recover. A startup probe indicates when an application has started and disables liveness and readiness checks until it succeeds, which is useful for slow-starting containers. Probes can be configured with handlers of type HTTPGetAction, TCPSocketAction, ExecAction, or grpc (added in 1.24), and their behavior is controlled by fields including initialDelaySeconds, periodSeconds, timeoutSeconds, successThreshold, failureThreshold, and terminationGracePeriodSeconds.

All chapters
  1. 1Pods and Container Fundamentals
  2. 2Workload Controllers and Scaling
  3. 3Services, Networking, and Discovery
  4. 4Namespaces, Configuration, and Storage
  5. 5Cluster Architecture and Scheduling
  6. 6Resource Management and Probes
  7. 7Security, Identity, and Admission Control
  8. 8Tooling, Extensibility, and Operations

Drill it

Reading is not remembering. These come from the Kubernetes Core Objects Cheatsheet deck:

Q

What is a Kubernetes Pod?

A Pod is the smallest deployable unit in Kubernetes; it encapsulates one or more tightly coupled containers that share a network namespace, IPC, and optionally...

Q

What does a Pod represent in the Kubernetes object model?

A Pod represents a single instance of a running process in a cluster and is described by a Pod manifest containing metadata (labels, annotations) and a pod spec...

Q

What Kubernetes object directly manages a set of identical Pods?

A ReplicaSet manages a stable set of identical Pods and ensures a specified number of pod replicas are running at any given time.

Q

What controller is most commonly used to deploy stateless workloads in production?

A Deployment, which manages a ReplicaSet and provides declarative updates, rolling updates, and rollback capability.