Let's look at another type of resource management, the constraint. We'll use the CPU dimension here, and we'll explore how to set the maximum and minimum values for available resources for a given container and pod in a namespace. There are a number of reasons you might want to limit CPU on a Kubernetes cluster:
- If you have a namespaced cluster that has different levels of production and non-production workloads, you may want to specify higher limits for your production workloads. You can allow quad-core CPU consumption for production; put pin development, staging, or UAT-type workloads to a single CPU; or stagger them according to environment needs.
- You can also ban requests from pods that require more CPU resources than your nodes have available. If you're running a certain type of machine on a cloud service provider, you can ensure that workloads that require X cores aren't scheduled on machines with <X cores.