Kubernetes 101 : Changing resource requirements for pods on the fly through deployments
In our example we have a deployment with three replicas of the "nginx" pod.
Below is the Yaml file of our deployment:
The "default-priority" assigned to the "nginx" pods is defined as below:
We create our PriorityClass using the "kubectl apply" command.
If for example, we check the events and we notice that our "nginx" pods are running out of resources - maybe consumed by other high-priority pods -, we could increase for our deployment and its three "nginx" replicas the limit of the resources it can use as below:
- The memory to 256 MiB for example.
- The CPU cores to 200 millicores for example.
For that we could use the below command: