<p>I know that the kubelet reports that the node is in diskpressure if there is not enough space on the node.<br />
But I want to know the exact threshold of diskpressure.<br />
Please let me know the source code of the kubelet related this issue if you could.<br />
Or I really thanks for your help about the official documentation from k8s or sth else.<br />
Thanks again!!</p>

<p>Disk pressure is a condition indicating that a node is using too much disk space or is using disk space too fast, according to the thresholds you have set in your Kubernetes configuration.</p>
<p>DaemonSet can deploy apps to multiple nodes in a single step. Like deployments, DaemonSets must be applied using kubectl before they can take effect.</p>
<p>Since kubernetes is running on Linux,this is easily done by running du command.you can either manually ssh into each kubernetes nodes,or use a Daemonset As follows:</p>
<pre><code>apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: disk-checker
  labels:
    app: disk-checker
spec:
  selector:
    matchLabels:
      app: disk-checker
  template:
    metadata:
      labels:
        app: disk-checker
    spec:
      hostPID: true
      hostIPC: true
      hostNetwork: true
      containers:
      - resources:
          requests:
            cpu: 0.15
        securityContext:
          privileged: true
        image: busybox
        imagePullPolicy: IfNotPresent
        name: disk-checked
        command: [&quot;/bin/sh&quot;]
        args: [&quot;-c&quot;, &quot;du -a /host | sort -n -r | head -n 20&quot;]
        volumeMounts:
        - name: host
          mountPath: &quot;/host&quot;
      volumes:
        - name: host
          hostPath:
            path: &quot;/&quot;
</code></pre>
<p>Available disk space and inodes on either the node's root filesystem or image filesystem has satisfied an eviction threshold, check complete <a href="https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#node-conditions" rel="nofollow noreferrer">Node Conditions</a> for more details.</p>
<p><strong>Ways to set Kubelet options :</strong></p>
<p>1)Command line options like --eviction-hard.</p>
<p>2)Config file.</p>
<p>3)More recent is dynamic configuration.</p>
<p>When you experience an issue with node disk pressure, your immediate thoughts should be when you run into the issue: an error in garbage collecting or log files. Of course the better answer here is to clean up unused files (free up some disk space).</p>
<p>So Monitor your clusters and get notified of any node disks approaching pressure, and get the issue resolved before it starts killing other pods inside the cluster.</p>
<p><strong>Edit :</strong>
AFAIK there is no magic trick to know the exact threshold of diskpressure . You need to start with reasonable (limits &amp; requests) and refine using trial and error.</p>
<p>Refer to this <a href="https://serverfault.com/questions/1031424/gke-kill-pod-when-monitoring-tool-still-show-that-we-have-memory">SO</a> for more information on how to set the threshold of diskpressure.</p>
