In Kubernetes, the mechanisms for controlling resources such as CPU and memory are
requests
and limits
.
Requests
are what the container is guaranteed to get. If a container requests a resource, Kubernetes will only schedule it on a node that can give it that resource.
Limits
make sure a container never goes above a certain value. The container is only allowed to go up to the limit, and then it is restricted.
In case you don't specify your CPU limit:
- The container can use all the processor resources available on the node on which it is running - because it has no upper bound on the CPU resources it can use.
- The container is automatically assigned the default limit when it is running in a namespace that has a default CPU limit. If there is a need to change that one can use LimitRange.
In situation that you specified a CPU limit but CPU request is not specified Kubernetes automatically assigns a CPU request that matches the limit.
To learn more see this documentation and this article.