Understanding Kubernetes Resource (CPU and Memory) Units

Tremaine Eto
The Startup
Published in
3 min readNov 10, 2020

--

Background photo by Thomas Vimare on Unsplash; Kubernetes logo public domain; illustration by Tremaine Eto.

In your Kubernetes journey, at some point you will probably deal with specifying how much of particular resources you need for containers, and two of the most common are resource limits and resource requests.

For both these limits and requests — and I’ll have another article digging deeper into those — you are able to set memory and cpu values.

Let’s take a look at the following pod YAML file for an example of this.

This article will go over the different units that you’re able to use in the memory and cpu fields. Spoiler alert: Mi and m, respectively, are not all that you are limited to.

Memory Units

Memory units are represented by the number of bytes.

With an Explicit Integer

So as a value, you could literally put 128974848, which means you are exactly specifying the number of bytes.

With an Exponent

--

--

Tremaine Eto
The Startup

Senior Software Engineer @ Iterable | Previously worked at DIRECTV, AT&T, and Tinder | UCLA Computer Science alumni | Follow me for software engineering tips!