Kubectl top node: where does microk8s define resource requirement?

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 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

1 Like

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 ?

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 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 ?

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

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).