How do I understand defining Pod CPU percentage when caculated by Linux cluster agent?
Suppose you have a Pod running on a Kubernetes cluster with the following CPU/Memory configuration:
resources:
limits:
cpu: "8"
memory: 4Gi
requests:
cpu: "4"
memory: 2Gi
When we do a kubectl top Pod, the output for the specific Pod is:
[root@SK8SPL01 svuser]# kubectl top pods -n abc-namespace | grep -i "abc-namespace"
abc-namespace-276371283-bndcl 4630m 2246Mi
This output means that the Pod is currently using 4630 millicores (total 4.63 CPUs) of the 8 CPUs allocated to it.
In Cluster Agent, the Pod’s CPU utilization percentage (%) shows as 463%. The standard Linux CPU utilization percentage is calculated.
No matter how many CPUs are available on a Linux machine (20 CPUs, 10 CPUs, or 5 CPUs), the CPU utilization % is calculated on how many cores are used. For example, out of 20 available CPUs, if 4 CPUs are used by a process, the CPU utilization percentage for the process will be 400%, not 20%).
Additional Resources
Assign CPU Resources to Containers and Pods
Monitor Kubernetes with the Cluster Agent
... View more