Is there any documentation that describes this "m" and "k". In the k8s documentation, I could see for "Mi", "Gi" etc, but not this. Any help would be greatly appreciated.
-
Please find this [GitHub](https://github.com/kubernetes/kubernetes/issues/79950) link for reference . – Hemanth Kumar Aug 18 '22 at 06:28
-
Thanks. I have gone through this link already. It was a discussion around it and does not look like a documentation on what "m" and "k" mean. One guy says "m" is for CPU and not for memory and other says its "millibyte". Both does not seem right as we can clearly see it was reported by kubectl as memory and also i guess "m" is millibit and not millibyte if i tried converting it to MB – Arun Prakash Nagendran Aug 18 '22 at 06:55
-
Here, m represents cpu in milli bit only . – Hemanth Kumar Aug 18 '22 at 11:23
-
Thanks. But what is the documentation that says "m" means "millibit" :) – Arun Prakash Nagendran Aug 19 '22 at 06:10
-
This is mentioned under resource units in Kubernetes. CPU and Memory are a resource Type and each has a basic unit. Please check this link: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ – Hemanth Kumar Aug 19 '22 at 12:29
2 Answers
After some research i got this : Those are Kubernetes-style quantities, Instead of displaying things as a decimal, it will display with SI suffixes. For instance, 1.5 becomes 1500m. When Kubernetes displays a quantity, it will tend to use milli-units if there would be a decimal point, and plain units otherwise. So, if it had to display 500 on the dot, it would just display 500, but if it's 500.5, it would display 500500m. So m means divide by 1000, k means times 1000. There's no documentation really except this. Search for "Kubernetes-style quantities" if you want to see more examples.
1m/750m = (1/1000)/(750/1000) = 0.001/.75 = .1%/75%
refer this link also

- 2,728
- 1
- 4
- 19
-
1Thank you for digging the k8s open source code to figure this out. Appreciate it ! – Arun Prakash Nagendran Aug 22 '22 at 03:58
I stumbled across the same issue and found out:
If you specifiy a memory request with a number that has a fractional part and its result (in Bytes) has a fractional part as well than this exotic unit millibyte is used.
It's even more exotic because 1024 m
is 1 Byte
.
For example:
0.2Gi
(214748364,8 Byte
) yields 214748364800m
whereas
0,5Mi
(524288 Byte
) yields 512Ki
"i" units (like Ki
, Mi
, Gi
, Pi
, Ei
) are base-2 units (1 Ki = 1024 Bytes, 1Mi = 1024x1024 Bytes and so on).

- 21
- 1
-
Thank you for posting! I thought I was going insane with 'helm upgrade' returning a warning that 'fractional byte value "214748364800m" is invalid, must be an integer' -- didn't know where this strange 'm' unit was coming from. My yaml happens to specify "0.2Gi" exactly as in your example. I would hope that kubernetes would understand that we want this figure to round to the nearest whole byte! Rather than pedantically complain about it. ( sigh ) My lesson: FRACTIONAL VALUES like 0.2Gi for memory limits are DANGEROUS. (0.25Gi would work, 0.125Gi would work 1/2, 1/4, 1/8, etc. powers of two.) – Barumpus Aug 30 '23 at 22:38