<p>I am looking for best practices to avoid <code>Pod The node had condition: [DiskPressure]</code>.</p>
<p>So what I'm doing is full database export of all our views which is massive. At some point the pod runs into DiskPressure error and the k8 decides to Evict and kill it.</p>
<p>What would be the best practices to handle this? There is 7GB of free space which maybe is not enough. Is just raising that the best way to go about it or are the other mechanisms to handle this type of work?</p>
<p>Hope my question makes sense</p>

vukojevicf
<p>Error message <code>Pod The node had a condition: [DiskPressure]</code>
happens when the kubelet agent won't admit new pods on the node, that means they won't start. Node disk pressure means that the disks that are attached to the node are under pressure.</p>
<p>The reason you might run into node disk pressure is because Kubernetes has not cleaned up any unused images and is a problem of logs building up.if you have a long-running container with a lot of logs, they may build up enough that it overloads the capacity of the node disk.</p>
<p><strong>Troubleshooting Node Disk Pressure:</strong></p>
<p>To troubleshoot the issue of node disk pressure, you need to figure out what files are taking up the most space. You can either manually SSH into each Kubernetes node, or use a DaemonSet, you can do that from this <a href="https://www.containiq.com/post/using-kubernetes-daemonsets-effectively" rel="nofollow noreferrer">link</a>.</p>
<p>After installing you can start looking at the logs of the pods that are running by executing kubectl logs -l app=disk-checker. You will see a list of files and their sizes, which will give you greater insight into what is taking up space on your nodes.</p>
<p><strong>Possible solutions:</strong></p>
<p>The issue is caused by necessary application data, making it impossible to delete the files. In this case, you will have to increase the size of the node disks to ensure that there’s sufficient room for the application files.</p>
<p>Another solution is that you find applications that have produced a lot of files that are no longer needed and  simply delete the unnecessary files.</p>
<p><strong>Adding more for your information:</strong></p>
<p><strong>1)To avoid DiskPressure crashing the node :</strong></p>
<p>DiskPressure triggers when either node root file systems or image file systems satisfies an eviction threshold for available disk space, inodes will trigger DiskPressure which in turn causes pod eviction,refer to these <a href="https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#node-conditions" rel="nofollow noreferrer">Node conditions</a>.</p>
<p>Based on the Node conditions, you should consider adjusting the parameters of your kubelet, <code>--image-gc-high-threshol</code>d and <code>--image-gc-low-threshold</code>, so that there is always enough space for normal operations, consider <code>--low-diskspace-threshold-mb</code> provisioning more space for your nodes, depending on your requirements.</p>
<p><strong>2) To reduce the DiskPressure condition</strong></p>
<p>Use the <a href="https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/" rel="nofollow noreferrer">kubelet</a> command line arg :
<code>--eviction-hard mapStringString:</code> A set of eviction thresholds (e.g. <code>memory.available&lt;1Gi</code>) that if met would trigger a pod eviction.
DEPRECATED: This parameter should be set via the config file specified by the Kubelet's <code>--config</code> flag. See <a href="https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/" rel="nofollow noreferrer">Set Kubelet parameters via a config file</a> for more information.</p>
