Skip to main content
RunBook Academy

KubernetesLXXXIV · Resource Capacity PlanningCapacity planning

Capacity planning — the discipline of resource budgeting

Advanced⏱ ~13 minkubectl

What you'll learn

  • Explain the capacity planning discipline
  • Identify the inputs (workload requirements, headroom, growth)
  • Compute the cluster sizing based on the inputs
  • Project the cost based on the sizing

Prerequisites

Verified against Kubernetes 1.34.x · kubeadm 1.34.x · kubectl 1.34.x · etcd 3.6.x · CoreDNS 1.11.x · containerd 1.7.x / 2.x · 2026-08-16

Not yet marked complete on this device.

Capacity planning is the discipline of resource budgeting. The inputs are the workload requirements, the headroom for failure, and the growth forecast. The outputs are the cluster sizing and the cost projection. This lesson walks the discipline, the inputs, the outputs, and the production patterns.

The discipline

Capacity planning is the act of answering three questions:

  1. How many nodes do we need?
  2. What is the cost?
  3. How does it grow over time?

The answers are the cluster’s sizing and cost projection.

flowchart LR
    A[Workload requirements] --> D[Capacity planning]
    B[Headroom] --> D
    C[Growth] --> D
    D --> E[Cluster sizing]
    D --> F[Cost projection]

The inputs

The inputs to capacity planning:

The workload requirements

Each workload has a resource requirement:

# Workload 1: nginx
spec:
  replicas: 5
  template:
    spec:
      containers:
      - name: nginx
        resources:
          requests:
            cpu: 500m
            memory: 1Gi

The workload requests 500m CPU and 1Gi memory per pod. With 5 replicas, the total is 2.5 vCPU and 5Gi memory.

The headroom

The headroom is the buffer for failure and growth:

Failure: 1 node failure tolerated
  - For 5 nodes: 1 node = 20% headroom
Growth: 20% growth over the next year
  - For 100 vCPU: 20 vCPU growth

The headroom is the sum of the failure tolerance and the growth forecast.

The growth forecast

The growth forecast is the workload’s expected growth:

Q1: 5 pods * 500m = 2.5 vCPU
Q2: 7 pods * 500m = 3.5 vCPU
Q3: 10 pods * 500m = 5 vCPU
Q4: 15 pods * 500m = 7.5 vCPU

The growth is per quarter; the yearly growth is summed.

The cluster sizing

The cluster sizing is the sum of the workload requirements plus the headroom:

Sum of workloads: 100 vCPU, 200Gi memory
Headroom (30%): 30 vCPU, 60Gi memory
Total: 130 vCPU, 260Gi memory

With 8 vCPU / 32Gi per node:
  Nodes needed: ceil(130 / 8) = 17 nodes
  Memory: 260 / 17 = 15Gi per node → fits within 32Gi

The sizing is per node type and per cluster.

flowchart LR
    A[Workload requirements] --> B[Sum per resource]
    B --> C[Add headroom]
    C --> D[Divide by node capacity]
    D --> E[Number of nodes]

The cost projection

The cost projection is the cluster sizing multiplied by the per-node cost:

17 nodes * $100/month/node = $1700/month
Annual: $20,400/year

The cost is per cluster; multi-cluster deployments multiply this by the number of clusters.

The capacity spreadsheet

A capacity spreadsheet captures the inputs and outputs:

Workload,Replicas,CPU per pod,Memory per pod,Total CPU,Total Memory
nginx,5,500m,1Gi,2.5,5Gi
api,10,1,2Gi,10,20Gi
db,3,2,8Gi,6,24Gi
batch,2,4,16Gi,8,32Gi
---
Total,20,,,26.5,81Gi
Headroom (30%),,,,,8,24Gi
Sizing,,,,,34.5,105Gi
Nodes (8 vCPU, 32Gi),,,,5,4
Cost ($100/month/node),,,,500,400

The spreadsheet is the input for the cluster sizing and the cost projection.

The growth-driven re-planning

The capacity plan is re-evaluated periodically:

flowchart LR
    A[Quarterly review] --> B[Workload requirements]
    B --> C[Growth forecast]
    C --> D[New sizing]
    D --> E[New cost projection]

The capacity plan is a living document. The quarterly review captures the changes.

The cluster sizing tools

The cluster sizing tools:

  • kubectl top: the current resource usage.
  • Prometheus: the historical resource usage.
  • VPA: the recommended requests.
  • Custom tools: company’s internal capacity planning spreadsheet.

The tools are the inputs for the plan.

The cluster sizing output

The cluster sizing output:

Cluster: production
Control plane: 3 nodes (4 vCPU, 16Gi each)
Workers: 5 nodes (8 vCPU, 32Gi each)
Total: 8 nodes (52 vCPU, 176Gi)

Workload:
  nginx: 5 replicas (500m CPU, 1Gi memory)
  api: 10 replicas (1 vCPU, 2Gi memory)
  db: 3 replicas (2 vCPU, 8Gi memory)  # StatefulSet
  batch: 2 replicas (4 vCPU, 16Gi memory)  # CronJob

Headroom: 30% (for failure and growth)

Cost: $800/month

The output is the cluster’s computer-readable description.

Cross-course references

  • The VPA course (Part LXXXIII) covers the right-sizing input.
  • The HPA course (Part LXXXII) covers the scaling assumption.
  • The Capacity Sizing course (Part LXXV) covers the node sizing.

Quiz

Knowledge check · 4 questions

  1. Q1. What is the headroom in capacity planning?

  2. Q2. Capacity planning is a one-time activity at cluster creation.

  3. Q3. Walk the capacity planning for a 5-workload cluster.

    5 workloads: nginx (5 replicas, 500m/1Gi), api (10 replicas, 1/2Gi), db (3 replicas, 2/8Gi), batch (2 replicas, 4/16Gi), monitoring (3 replicas, 1/4Gi). The team is computing the cluster sizing and cost.

  4. Q4. What are the inputs to a capacity planning spreadsheet?

Passing score: 75%. Answers are checked in this browser.

Production discipline

  • Maintain the capacity spreadsheet. Living document.
  • Review the plan quarterly. Capture the workload changes.
  • Compute the cluster sizing. Workload + headroom.
  • Project the cost. Sizing * per-node cost.
  • Document the plan. The workload, the headroom, the cost.
  • Use the VPA recommendations. The right-sizing input.

Capacity planning is the cluster’s budget. Operating it well is maintaining the spreadsheet, reviewing the plan, and projecting the cost.