What do the Kubernetes memory suffixes `Ki`, `Mi`, `Gi`, `Ti` mean, and how do they differ from `k`, `M`, `G`, `T`?
Quick Answer
The `i` suffixes are IEC binary units (powers of 1024): 1Ki=1024, 1Mi=1024², 1Gi=1024³, 1Ti=1024⁴ bytes. The plain suffixes are SI decimal units (powers of 1000): 1k=1000, 1M=10⁶, 1G=10⁹, 1T=10¹² bytes. For memory, always prefer the binary `Mi`/`Gi` forms.
Detailed Answer
Kubernetes quantities support both notations, and mixing them silently changes how many bytes you actually get:
- 1Ki = 1,024 bytes | 1k = 1,000 bytes
- 1Mi = 1,048,576 bytes | 1M = 1,000,000 bytes
- 1Gi = 1,073,741,824 bytes | 1G = 1,000,000,000 bytes
- 1Ti = 1,099,511,627,776 bytes | 1T = 10^12 bytes
The divergence grows with scale: Gi is ~7.4% larger than G. Tools that report memory (free, top, the kernel, cgroups, JVM -Xmx) overwhelmingly use binary units, so Mi/Gi keeps your manifests consistent with what you observe at runtime.
Code Example
# Quantity → bytes # 256Mi = 268435456 # 1Gi = 1073741824 # 1G = 1000000000 (73,741,824 bytes fewer than 1Gi)
Interview Tip
Memorize 1Mi = 1,048,576 and 1Gi = 1,073,741,824 — being able to convert on the spot signals real fluency.