Memory Requests And Limits In Kubernetes
In Kubernetes, what should I use as memory requests and limits? And what happens when you don’t set them? Let’s dive into it. In Kubernetes, you have two ways to specify how much CPU a pod can use: “Requests” are usually used to determine the average consumption. “Limits” set the max number of resources allowed. The Kubernetes scheduler uses requests to determine where the pod should be allocated in the cluster. Since the scheduler doesn’t know the consumption (the pod hasn’t started yet), it needs a hint. The kubelet uses limits to stop the process when it uses more memory than is allowed. It’s worth noting that the process could spike in memory usage before it’s terminated. The kubelet is also in charge of monitoring the total memory utilization of the node. If memory is running low, the kubelet evicts low-priority pods. But how does it decide what’s low priority? When Kubernetes creates a Pod, it assigns one of these QoS classes to the Pod: Guaranteed Burstable BestEffort Pods...