Feedback

Chat Icon

Cloud-Native Microservices With Kubernetes - 2nd Edition

A Comprehensive Guide to Building, Scaling, Deploying, Observing, and Managing Highly-Available Microservices in Kubernetes

Understanding Resource Management in Kubernetes
40%

Memory Resource Units

Memory resources are measured in bytes.

ℹ️ A byte is a unit of memory size and is equal to 8 bits. A bit is a unit of data and is either 0 or 1. A byte is the smallest addressable unit of memory.

You can express memory using one of these suffixes: E, P, T, G, M, K, where:

  • E = Exabyte (1,000,000,000,000,000,000 bytes)
  • P = Petabyte (1,000,000,000,000,000 bytes)
  • T = Terabyte (1,000,000,000,000 bytes)
  • G = Gigabyte (1,000,000,000 bytes)
  • M = Megabyte (1,000,000 bytes)
  • K = Kilobyte (1,000 bytes)

Or use the following suffixes: Ei, Pi, Ti, Gi, Mi, Ki, where:

  • Ei = Exbibyte (1,152,921,504,606,846,976 bytes)
  • Pi = Pebibyte (1,125,899,906,842,624 bytes)
  • Ti = Tebibyte (1,099,511,627,776 bytes)
  • Gi = Gibibyte (1,073,741,824 bytes)
  • Mi = Mebibyte (1,048,576 bytes)
  • Ki = Kibibyte (1,024 bytes)

You can use the suffix m to mean milli. For example, 100m means 100 milli, which is 100/1000 = 0.1. So 100m is equivalent to 0.1 bytes.

Here is an example that sets memory requests and limits for a container without CPU specifications:

apiVersion: v1
kind: Deployment
metadata:

Cloud-Native Microservices With Kubernetes - 2nd Edition

A Comprehensive Guide to Building, Scaling, Deploying, Observing, and Managing Highly-Available Microservices in Kubernetes

Enroll now to unlock all content and receive all future updates for free.