# Kubectl top node: where does microk8s define resource requirement?

**URL:** <https://discuss.kubernetes.io/t/kubectl-top-node-where-does-microk8s-define-resource-requirement/10972>\
**Category:** microk8s\
**Created:** [May 18, 2020, 4:21pm UTC](https://discuss.kubernetes.io/t/kubectl-top-node-where-does-microk8s-define-resource-requirement/10972 "2020-05-18T16:21:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TristanStanic](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/tristanstanic/32/5148_2.png) [@TristanStanic](https://discuss.kubernetes.io/u/TristanStanic)\
**Post date:** [May 18, 2020, 4:21pm UTC](https://discuss.kubernetes.io/t/kubectl-top-node-where-does-microk8s-define-resource-requirement/10972/1 "2020-05-18T16:21:35Z")

</div>

microk8s v1.18 on Ubuntu 20.04

```
$ kubectl top node
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%   
myhostname 1369m 17% 8389Mi 26%  

```

Q1. `CPU(cores) = 1369m`, [CPU units](https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/#cpu-units) explains that this means 1369milliCPU = 1.369 CPU. Where did this value came from? The physical host has 8 cores (AMD-FX8320), Why did microk8s allocate exactly this value?

Q2. `MEMORY(bytes) = 8389Mi`, on which basis microk8s had decided to allocate this amount of RAM to the node?

Thanks

---

<div class="post-metadata">

**Author:** ![kjackal](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/kjackal/32/1750_2.png) [@kjackal](https://discuss.kubernetes.io/u/kjackal)\
**Post date:** [May 19, 2020, 6:33am UTC](https://discuss.kubernetes.io/t/kubectl-top-node-where-does-microk8s-define-resource-requirement/10972/2 "2020-05-19T06:33:09Z")

</div>

I do not have a definitive answer on your question (eg the code for ranking CPUs). Just want to point out that these numbers are what Kubernetes detects.

These numbers do not look unreasonable. 8 cpu threads of 2012 could be 1.369 threads of a current i7. How much memory does your node have? What do you seen in `free -m` ?

---

<div class="post-metadata">

**Author:** ![TristanStanic](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/tristanstanic/32/5148_2.png) [@TristanStanic](https://discuss.kubernetes.io/u/TristanStanic)\
**Post date:** [May 19, 2020, 1:34pm UTC](https://discuss.kubernetes.io/t/kubectl-top-node-where-does-microk8s-define-resource-requirement/10972/3 "2020-05-19T13:34:27Z")

</div>

> these numbers are what Kubernetes detects.

I suppose Kubernetes detects what microk8s had configured the hardware resource to the single-node at installation time. When I installed microk8s 1.18 following the [Quick Start guide](https://microk8s.io/docs/) there were no mention of how the hardware resource should be allocated. I would have given more resource if there was such a possibility. Unless the resources could be allocated to the node dynamically as needed. Is it possible?

> What do you seen in `free -m` ?

```auto
$ free -m
              total used free shared buff/cache available
Mem: 32139 6992 13060 321 12086 24808
Swap: 7627 99 7528

```

---

<div class="post-metadata">

**Author:** ![kjackal](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/kjackal/32/1750_2.png) [@kjackal](https://discuss.kubernetes.io/u/kjackal)\
**Post date:** [May 19, 2020, 2:02pm UTC](https://discuss.kubernetes.io/t/kubectl-top-node-where-does-microk8s-define-resource-requirement/10972/4 "2020-05-19T14:02:13Z")

</div>

I am sorry I read this wrong.

8389Mi is the memory used and is 26% of the total memory.

1369 is the CPU milli-units used and is the 17% of the total threads you have.

This matches your hardware. MicroK8s does not specify any resources. Kubernetes autodetects the available resources with the help of the metrics-server (`microk8s enable metrics-server`).
