This chapter explains Kubernetes cost from the inside: how a node's hourly price becomes the price of a pod, why a cluster costs money with no load on it, and which decisions inside the cluster, not in the cloud console, set the bill. The cloud charges a cluster for three things only: the control plane, the nodes, and what hangs off them, disks, load balancers, traffic. Everything teams want to know, what a namespace, a deployment or an environment costs, has to be computed from those lines first, and this chapter describes the mechanics behind that computation.
What this chapter covers
Four pages of the handbook already cover Kubernetes, each with its own question: what the providers charge for containers and Kubernetes, how Kubernetes cost data is produced, how allocation by namespace and label works, and where a cluster's efficiency is lost. This chapter sits between those pages, at the mechanisms they assume: the convention by which a pod is priced, the node pool as the unit of billing, the autoscalers that add and remove nodes, and the kinds of cost no workload carries.
Five sections structure the chapter:
- What a pod costs derives a pod's price from requests, limits and usage: the convention OpenCost and GKE Autopilot calculate by, the weighting of CPU and memory in a node's price, and the gap between request and usage that remains as idle.
- Nodes and scaling covers the node pool and instance selection, Cluster Autoscaler and Karpenter, HPA, VPA and KEDA, and spot and preemptible nodes: the decisions that set how many nodes of which kind run and what they cost per hour.
- Cluster overhead covers idle and unallocated cost and the shared costs of a cluster: system components, agents, the control plane and free capacity, and the three ways to spread them across teams.
- Storage, network and GPUs covers persistent volumes and snapshots, services, load balancers and egress, and GPU nodes and their sharing: the lines a cluster produces outside its nodes.
- Across clusters, environments and providers compares the fees of EKS, AKS and GKE, works through the fixed cost of non-production clusters, and describes capacity planning with headroom, commitments and spot.
Every page follows the shape of the concept pages: how the mechanism works, with a subsection per provider only where AWS, Azure and Google Cloud differ, what it means for the cost, where it goes wrong in practice, and an example that calculates from a published list price. The vocabulary follows the OpenCost specification, which defines asset, workload, idle and shared cost; the pages name it with its source.
Key terms
- Node pool: the group of nodes with one machine type and scaling range; the unit the cloud bills.
- Resource requests: the CPU and memory a pod asks for; the basis on which its share of the node's price is computed.
- Idle cost: paid capacity no workload uses or requests; in a cluster, the difference between the node price and the sum of the pod costs.
- Shared cost: lines that serve several teams, from kube-system to the cluster fee, spread by a key.
- Unallocated cost: the remainder that has no owner after allocation and distribution.
- Spot capacity: the provider's spare capacity at a fluctuating price that can be reclaimed at any time; as a node pool, a lever with a risk.
- Auto-scaling: adjusting capacity to load automatically; in a cluster on two levels, pods and nodes, which decide the bill together.
- Extended support: the surcharge on the cluster fee for a Kubernetes version past the end of standard support.
- Cost allocation: assigning cost to teams, products or environments; in a cluster, the outcome of the mechanics described here.
Neighbouring chapters
"What cloud services cost" names the prices the providers charge for the control plane, nodes and pods; this chapter explains what a team makes of them. The pages on EKS, ECS and Fargate in the chapter on AWS carry the pricing dimensions and usage types the comparison page here points to. "Allocation and ownership" takes the pod costs derived here and assigns them to cost centres; "Optimisation and savings" starts from requests, nodes and idle, whose mechanics sit here. The data all of this is computed from is described in "Billing data and standards"; spot prices and commitments as purchase options are explained in "Pricing models and commitments" with its page on spot instances and preemptible capacity. What an agent in the cluster reads for cost reporting is on the Kubernetes integration page.