kubernetes

What is the meaning of CPU and core in Kubernetes?


I don't really understand this after reading through the document. Some use a term like "CPU", but some use "core".

I am running Kubernetes in my laptop for testing purpose. My laptop has one CPU (2.2 GHz) and four cores.

If I want to set the CPU request/limit for pod, should the maximum resource that I have be 1000m or 4000m?

What is the difference (CPU vs. core) here in a Kubernetes context?


Solution

  • To remove any guesswork regarding your laptop or any other environment, execute:

    kubectl get nodes
    

    ...and then this for a particular node:

    kubectl describe node <node-name>
    

    Look for cpu under Allocatable (which may have the same value as under 'Capacity').

    Take into consideration that

    1 CPU = 1000 millicores/millicpu
    

    when setting "fractional" resources.requests.cpu and resources.limits.cpu for containers.