<p>If <code>limit</code> resources are greater than <code>request</code> resources, K8 will assign pod to <a href="https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod/#create-a-pod-that-gets-assigned-a-qos-class-of-burstable" rel="nofollow noreferrer">QoS Burstable</a></p>
<p>Sample configuration:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: test-metadata
  namespace: demo
spec:
  containers:
  - name: test1
    image: nginx
    resources:
      limits:
        memory: &quot;14Gi&quot;
      requests:
        memory: &quot;4Gi&quot;
</code></pre>
<ul>
<li>Will Kubernetes <strong>always</strong> assign this pod on an instance that will have 14GB memory?</li>
<li>Will Kubernetes <strong>always</strong> reserve 14 GB memory for this pod? If yes, then how is it different than <code>QoS Guaranteed</code> class?</li>
</ul>
<p>I don't want to use <code>QoS Guaranteed</code> as the workload can vary.</p>

<p>Memory limits are not taken into consideration when scheduling pods.</p>
<p><em>Will Kubernetes always assign this pod on an instance that will have 14GB memory?</em></p>
<p>By default, this pod will be assigned to any node that meets the request for 4GB memory.</p>
<p>On the node side, any pod that uses more than its requested resources is subject to eviction when the node runs out of resources. In other words, Kubernetes never provides any guarantees of availability of resources beyond a Pod's requests.</p>
<p>Using a memory limit that exceeds the node's total memory will never be reached.</p>
<p><em>Will Kubernetes always reserve 14 GB memory for this pod? If yes, then how is it different than QoS Guaranteed class?</em></p>
<p>No, by default kubernetes will reserve the least amount of memory needed which would be 4GB as request.</p>
<p>Scheduler also takes into consideration <a href="https://kubernetes.io/docs/reference/scheduling/config/" rel="nofollow noreferrer">scheduler configuration</a> and <a href="https://kubernetes.io/docs/reference/scheduling/policies/" rel="nofollow noreferrer">scheduler policies</a>:</p>
<blockquote>
<p>Scheduler configuration allows to customize the behavior of the <code>kube-scheduler</code> by writing a configuration file and passing its path as a command line argument.</p>
</blockquote>
<blockquote>
<p>A scheduling Policy can be used to specify the <em>predicates</em> and <em>priorities</em> that the <a href="https://kubernetes.io/docs/reference/generated/kube-scheduler/" rel="nofollow noreferrer">kube-scheduler</a> runs to <a href="https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/#kube-scheduler-implementation" rel="nofollow noreferrer">filter and score nodes</a>, respectively.</p>
</blockquote>
