

- #The node was low on resource ephemeral storage movie#
- #The node was low on resource ephemeral storage full#
If you’ll wait until the very end of the movie you’ll notice the moment when the Kubelet puts the node in a low-memory state. You can actually see their list in the eviction message in the kernel logs (at 01:43, using high quality and slowing playback rate) which includes Grafana, kube-state-metrics, Prometheus node exporter, a couple of debug containers and some pods in the kube-system namespace. Why? Because there were other pods running already on that the node taking a bit over 200 MiB. We could have even allocated a couple MiB less memory with the leak tool – so its overall RAM footprint would have been below the “allocatable” value and and we’d still have seen the same outcome. But this value is slightly larger than the “allocatable” value for the node – which is just under 4600 MiB as seen in the kubectl describe node previously – and, since the -enforce-node-allocatable=pods default flag is used by the node’s Kubelet, moments later we see the Kubelet evicting the pod, with explicit messages of why and how it does so. The leak tool successfully completes its run, which results in around 4700 MiB used in RAM – the sum of the 4600 MiB it allocated and around 100 MB for the underlying.

The top left window is the raw output from the leak tool as it allocates, the right window tails the status of the pod while the window at the bottom is tailing messages emitted by the Kubelet. The leak memory tool allocates (and touches) memory in blocks of 100 MiB until it reaches its set input parameter of 4600 MiB. The pod’s manifest doesn’t specify any request or limit for the container running the app. Here’s how the section of interest looks like for one of nodes of the Kubernetes cluster used throughout this article (a 7-GiB Azure DS2_v2 node):Ī Kubernetes pod is started that runs one instance of the leak memory tool. We can easily see the value by checking the output of kubectl describe node. This feature is enabled by default via the -enforce-node-allocatable=pods and once the memory usage for the pods crosses this value, the Kubelet triggers the eviction mechanism: “ Enforcement is performed by evicting pods whenever the overall usage across all pods exceeds ‘Allocatable’” as documented here. But when exactly?Īs per the official Kubernetes docs “ ‘Allocatable’ on a Kubernetes node is defined as the amount of compute resources that are available for pods“. Let’s go ahead for now, and as we get further along the answer will gradually appear.īut when does the Kubelet decide to evict pods? “Low memory situation” is a rather fuzzy concept: we’ve seen that the OOM killer acts at the system level (in OOM killer) when memory is critically low (essentially almost nothing left), so it follows that pod evictions should happen before that. This still doesn’t answer the initial question of why are both mechanisms needed, but only goes to tell that Kubernetes has to “live with” the OOM killer. by setting different values for oom_score_adj it alters the latter’s behavior as to which victim gets chosen first.

What Kubernetes does – and to be more specific the Kubelet on each node – is adjust the “knobs” for the OOM killer: e.g. Remember that it’s a Linux kernel feature. Kubernetes doesn’t have direct control on the OOM killer. So why have both of them active at the same time? So it’s quite apparent these 2 mechanisms – pod evictions and the OOM killer – have the same goal: ensure the node doesn’t end up without any memory left. Previously (in OOM killer and Cgroups and the OOM killer) we’ve seen how the OOM killer will ensure the available memory on the node doesn’t go below critical levels. As this article deals with memory, we’ll talk exclusively about memory as the resource a node is experiencing a shortage of. What are pod evictions in Kubernetes? It’s an automatic action that Kuwbernetes takes on a node experiencing low resources whereby one or more pods are terminated in an effort to reduce the pressure.
#The node was low on resource ephemeral storage full#
You can find the article’s full table of contents here as part of the first post. This is part 4 of a four-part article that looks into what happens in detail when Kubernetes runs into out-of-memory (OOM) situations and how it responds to them.
