<p>I have a pod which exceeds the disk resource limits sometimes for a short time. The pod then gets evicted. Is there a way to allow the pod to exceed the resource limits for e.g. 30 seconds?</p>

User12547645
<p>Yes, if the sizeLimit is breached your Pod will be evicted (Kubernetes will terminate your containers and schedule a replacement Pod). If the node where a Pod is running has enough of a resource available, it's possible for a container to use more resources than its request for that resource specifies. However, a container is not allowed to use more than its resource limit.</p>
<p>As suggested by David Maze, Nodes have <strong>local ephemeral storage</strong>. You can provide a default ephemeral-storage request and limit on your LimitRange. A <a href="https://kubernetes.io/docs/concepts/policy/limit-range/" rel="nofollow noreferrer">LimitRange</a> is a policy to constrain resource allocations (to Pods or Containers) in a namespace.</p>
<p>To make the resource quota work on ephemeral-storage, two things need to be done:</p>
<ul>
<li>An admin sets the resource quota for ephemeral-storage in a namespace.</li>
<li>A user needs to specify limits for the ephemeral-storage resource in the Pod spec.</li>
</ul>
<p>The <code>kubelet</code> can measure how much local storage it is using. It does
this provided that you have set up the node using one of the
supported configurations(single or two file systems) for local
ephemeral storage.If you have a different configuration, then the
kubelet does not apply resource limits for ephemeral local storage.</p>
<p>If the user doesn't specify the ephemeral-storage resource limit in the Pod spec, the resource quota is not enforced on ephemeral-storage.</p>
<p>Kubernetes lets you track, reserve and limit the amount of ephemeral local storage a Pod can consume.If a Pod is using more ephemeral storage than you allow it to, the kubelet sets an eviction signal that triggers Pod eviction.</p>
<p>Example:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: nginx
    resources:
      requests:
        ephemeral-storage: &quot;2Gi&quot;
      limits:
        ephemeral-storage: &quot;4Gi&quot;
    
</code></pre>
<p>You can refer to <a href="https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#how-pods-with-ephemeral-storage-requests-are-scheduled" rel="nofollow noreferrer">how pods with ephemeral storage requests are scheduled.</a></p>
