Course contentsShow
← Cloud and Infrastructure
Lesson 1331 of 2,98927. Kubernetes Scheduling and ResourcesFree lesson

Memory Resource Units

Learn how memory is measured in Kubernetes using bytes, Ki, Mi, Gi, and other suffixes.

Memory Resource Units

What you'll learn: How Kubernetes measures memory so you can accurately request and limit RAM for your containers.

Why Memory Units Matter

In the previous lesson you learned about CPU units (millicores). Memory works differently—it's measured in bytes, which are straightforward but can get unwieldy when dealing with gigabytes of RAM. Kubernetes lets you express memory using convenient suffixes instead of writing out enormous numbers.

Understanding Memory Suffixes

Kubernetes accepts memory values in bytes or with these suffixes:

  • Plain number: bytes (e.g., 1000000 = 1 million bytes)
  • E, P, T, G, M, K: Powers of 1000 (decimal)
  • Ei, Pi, Ti, Gi, Mi, Ki: Powers of 1024 (binary)

Binary vs Decimal

This is where it gets interesting. Computer memory naturally works in powers of 1024 (binary), while marketing and SI units often use powers of 1000 (decimal).

Binary (base-2):

  • 1 Ki = 1024 bytes
  • 1 Mi = 1024 Ki = 1,048,576 bytes
  • 1 Gi = 1024 Mi = 1,073,741,824 bytes

Decimal (base-10):

  • 1 K = 1000 bytes
  • 1 M = 1000 K = 1,000,000 bytes
  • 1 G = 1000 M = 1,000,000,000 bytes

Practical Example

If you want to request 128 megabytes of memory, you could write:

  • 134217728 (bytes—hard to read!)
  • 128Mi (binary—preferred, matches how RAM actually works)
  • 128M (decimal—slightly less than 128Mi)

Best practice: Use binary units (Ki, Mi, Gi) since they align with how memory is physically allocated.

Key Takeaway: Kubernetes measures memory in bytes with convenient suffixes like Mi (mebibytes, 1024²) and Gi (gibibytes, 1024³)—always prefer binary units for accuracy when requesting memory resources.