CPU Resource Units
What you'll learn: How Kubernetes measures and allocates CPU resources using millicores and core fractions.
In the previous lesson, you learned that resource requests and limits help Kubernetes schedule Pods and prevent resource starvation. Now let's understand exactly how CPU is measured and specified.
How CPU is Measured
In Kubernetes, CPU resources are measured in CPU units, which represent compute power. One CPU unit equals:
- 1 physical CPU core (on bare metal)
- 1 virtual core (vCPU in cloud environments)
- 1 hyperthread (on some processors)
Think of a CPU core like a lane on a highway—each lane can handle one stream of traffic at full speed.
Millicores: Fractional CPU
Kubernetes allows you to request fractions of a CPU using millicores (thousandths of a core):
1000m(1000 millicores) = 1 full CPU core500m= half a CPU core100m= one-tenth of a CPU core1m= 0.001 of a CPU core (the smallest unit)
This is like splitting a highway lane into 1000 tiny slices, allowing multiple containers to share the same core.
Equivalent Notations
You can specify CPU in two ways:
- Decimal notation:
0.5(half a core) - Millicore notation:
500m(500 millicores)
Both mean exactly the same thing. 1.0 = 1000m, 0.1 = 100m, and so on.
Why This Matters
Understanding CPU units lets you accurately size your containers. A lightweight web server might need 100m, while a data-processing job might need 2000m (2 cores).
Key Takeaway: Kubernetes measures CPU in cores and millicores (thousandths of a core), allowing precise fractional allocation like 500m for half a CPU or 0.25 for a quarter core.