Kubernetes Resource Requests and Limits: A Practical Rightsizing Workflow for CPU and Memory
Kubernetescloud infrastructureresource managementautoscalingplatform engineering

Kubernetes Resource Requests and Limits: A Practical Rightsizing Workflow for CPU and Memory

NNetworked DevOps Hub
2026-11-29
7 min read

A practical Kubernetes workflow for measuring usage, choosing CPU and memory requests and limits, and validating rightsizing changes safely.

Kubernetes resource requests and limits determine how workloads are scheduled, how much capacity a cluster reserves, and what happens when a container needs more memory or CPU than its manifest allows. This practical rightsizing workflow helps you measure real usage, choose defensible values, and validate changes without trading wasted capacity for throttling, evictions, or unstable deployments.

Overview

In Kubernetes, a container’s request is the amount of CPU or memory the scheduler uses when deciding where to place a pod. A limit is the maximum resource amount the container is permitted to consume, subject to the behavior of the resource and the node configuration.

SettingWhat it influencesWhat happens when it is wrong
CPU requestScheduling capacity and resource accountingToo low can make a workload appear inexpensive to schedule; too high can leave capacity stranded
Memory requestScheduling and eviction priority under memory pressureToo low can increase eviction risk or create misleading capacity assumptions
CPU limitMaximum CPU allocation enforced by the runtime and kernel mechanismsToo low can cause throttling during legitimate bursts
Memory limitMaximum memory a container can useToo low can lead to an out-of-memory termination; too high can reduce protection between workloads

Requests and limits are not performance targets. They are operating boundaries. A request should represent the capacity the workload needs for reliable scheduling, while a limit should reflect an intentional upper bound rather than an arbitrary multiple. The right values depend on workload type, traffic patterns, startup behavior, batch duration, availability requirements, and the degree of burstiness your cluster can absorb.

For CPU, temporary demand above the request may be possible when node capacity is available, but a restrictive limit can cause throttling. Memory is different: it is not safely reclaimable in the same way as CPU. A container that exceeds its memory limit may be terminated, and a node under memory pressure may evict pods according to Kubernetes resource and priority conditions.

Checklist by scenario

1. Start with an observed baseline

Measure usage before editing manifests. Collect data across normal traffic, expected peaks, scheduled jobs, deployments, cache warm-up, and failure recovery where possible. A single point-in-time reading is not enough for a rightsizing decision.

Useful inspection commands include:

kubectl get pods -n <namespace> -o wide
kubectl describe pod <pod-name> -n <namespace>
kubectl top pod -n <namespace> --containers
kubectl top nodes

The kubectl top commands require a working metrics pipeline and are useful for current usage, not long-term trend analysis. For durable decisions, use your observability platform or metrics backend to inspect CPU usage, memory working set, restarts, throttling indicators, evictions, and container termination reasons over a representative period.

2. Deployments and stateless services

  • Measure each container separately. A sidecar, proxy, telemetry agent, and application container can have very different profiles.
  • Set CPU requests near sustained normal demand, then account for the service’s latency and throughput requirements.
  • Set memory requests high enough to represent the workload’s normal footprint, including runtime overhead and expected cache behavior.
  • Use CPU limits only when you have a clear reason to cap bursts or protect node capacity. Test the effect on latency before adopting a restrictive value.
  • Set memory limits above normal usage with room for expected variation, but investigate continuous growth rather than masking it with an increasingly large limit.
  • Compare the result with the replica count and horizontal pod autoscaling configuration. A request change can alter how quickly autoscaling responds and how much capacity each replica reserves.

3. Jobs and scheduled workloads

  • Measure the complete job lifecycle, including initialization, peak processing, and cleanup.
  • Use a request that allows the job to be scheduled predictably during its operating window.
  • Set a memory limit that prevents one defective or unexpectedly large job from consuming unbounded node memory.
  • Check activeDeadlineSeconds, retry behavior, parallelism, and concurrency. Resource sizing cannot compensate for an overly aggressive retry policy.
  • For bursty batch work, coordinate resource requests with scheduling windows and cluster autoscaling rather than assuming unused daytime capacity will always be available.

4. Stateful services

  • Include steady-state memory, caches, connection pools, compaction, replication, backups, and recovery behavior in the measurement plan.
  • Do not resize a stateful workload during an incident unless the change is part of an understood mitigation.
  • Validate disruption budgets, storage performance, pod placement, and failover behavior alongside CPU and memory.
  • Use conservative memory settings when an unexpected termination could affect recovery time or data availability.
  • Document whether the resource values apply to the database process, an operator-managed pod, or supporting sidecars.

5. A reusable measurement worksheet

For every workload, record:

  • Namespace, workload name, container name, owner, and environment.
  • CPU request and limit, plus memory request and limit.
  • Observed typical usage, high-percentile usage, and maximum observed usage for CPU and memory.
  • Measurement window and whether it includes peak traffic, releases, restarts, and scheduled work.
  • Throttling, out-of-memory events, evictions, restarts, and latency or throughput symptoms.
  • Replica count, autoscaling configuration, node pool, and workload criticality.
  • Proposed values, reason for the change, reviewer, rollout date, and validation result.

6. Namespace policy checklist

  • Confirm whether the namespace has a LimitRange that supplies defaults or enforces minimum and maximum values.
  • Review ResourceQuota settings so a rightsizing change does not unexpectedly block new pods or deployments.
  • Decide whether every production container must declare requests and limits explicitly.
  • Make exceptions visible and documented, especially for system agents, performance-sensitive services, and workloads managed by an operator.
  • Check admission policies and deployment templates so a policy change does not silently rewrite values.

What to double-check

Before applying a change, inspect the actual rendered manifest rather than only the source template. Helm values, Kustomize overlays, admission controllers, and platform defaults can produce different resource settings in different environments.

kubectl get deployment <deployment-name> -n <namespace> -o yaml
kubectl get pod <pod-name> -n <namespace> -o jsonpath='{range .spec.containers[*]}{.name}{"\t"}{.resources}{"\n"}{end}'

Double-check the following:

  • Units: CPU values such as 500m and memory values such as 512Mi are not interchangeable with informal shorthand. Keep units explicit and consistent.
  • Per-container versus per-pod totals: Scheduling considers the sum of container requests in a pod, including sidecars and init-container rules.
  • Startup behavior: Initialization can require more CPU or memory than steady state. Confirm that startup requests do not prevent placement and that limits do not terminate legitimate initialization.
  • QoS classification: The combination of requests and limits affects a pod’s quality-of-service classification and can influence behavior during resource pressure.
  • Node allocatable capacity: Compare pod requests with allocatable, not merely the raw capacity shown for a node. System and daemon workloads consume part of the node.
  • Autoscaling signals: If an autoscaler uses utilization relative to requests, changing the request changes the meaning of the observed utilization.
  • Cloud cost assumptions: A lower request does not automatically reduce the cost of a fixed-size node pool. Validate savings against node packing, autoscaling, reservations, and provider-specific billing behavior.

Roll out rightsizing in a controlled sequence. Change a small group of comparable workloads, observe scheduling, latency, restarts, throttling, memory pressure, and autoscaling behavior, then expand the change. Keep the previous values available for quick rollback.

Common mistakes

  • Copying the same values everywhere: An API, worker, database, and telemetry sidecar have different resource profiles. Start with workload-level evidence.
  • Setting limits far above requests without a reason: This can hide demand, create contention, and make capacity planning less predictable.
  • Treating CPU throttling as proof of insufficient CPU: Check the limit, request, workload latency, throttling duration, and node contention together. A limit may be the immediate constraint.
  • Using memory usage alone: Memory growth, cache retention, garbage collection, and kernel accounting can make a snapshot misleading. Review trends and termination events.
  • Ignoring sidecars and init containers: Supporting containers contribute to pod placement and can become the largest consumer after an application is optimized.
  • Rightsizing during an incident: Emergency changes often lack a measurement window and may create a second failure. Record the mitigation, then perform a structured review afterward.
  • Changing requests without reviewing autoscaling: The same workload can scale earlier or later after its request changes, depending on the configured metric.

When to revisit

Review resource settings at least before seasonal planning cycles, capacity reviews, major traffic changes, and platform migrations. Also revisit them after a Kubernetes version change, node-type change, cloud-provider change, runtime upgrade, architecture change, or significant application release.

A monthly review is useful for high-change production workloads. Compare the worksheet with current manifests and look for drift between declared resources and observed behavior. Recheck after changing autoscaling thresholds, replica policies, deployment strategies, or observability tooling. For reference, Kubernetes deployment choices such as rolling, blue-green, and canary releases can change temporary capacity requirements; review the Kubernetes deployment strategies comparison before planning a rollout that temporarily runs old and new versions together.

Use this closing checklist:

  1. Export current requests and limits from the live cluster.
  2. Review representative CPU and memory data, including peaks and failure signals.
  3. Identify the constraint: scheduling, CPU throttling, memory pressure, autoscaling, or cost.
  4. Propose one measured change per workload group.
  5. Render and inspect the final manifests and namespace policies.
  6. Roll out gradually with rollback values documented.
  7. Validate performance, reliability, placement, and capacity after the change.
  8. Record the decision and set the next review trigger.

Rightsizing is not a one-time search for perfect numbers. It is a repeatable operating practice: observe, change one assumption, validate the result, and update the record when the workload or cluster changes.

Related Topics

#Kubernetes#cloud infrastructure#resource management#autoscaling#platform engineering
N

Networked DevOps Hub

Editorial Team

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.