<p>I have a container running in a GKE autopilot K8s cluster. I have the following in my deployment manifest (only relevant parts included):</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
spec:
  template:
    spec:
      containers:
          resources:
            requests:
              memory: &quot;250Mi&quot;
              cpu: &quot;512m&quot;
</code></pre>
<p>So I've requested the minimum resources that <a href="https://cloud.google.com/kubernetes-engine/docs/concepts/autopilot-overview#allowable_resource_ranges" rel="noreferrer">GKE autopilot allows for normal pods</a>. Note that I have not specified a <code>limits</code>.</p>
<p>However, having applied the manifest and looking at the yaml I see that it does not match what's in the manifest I applied:</p>
<pre><code>    resources:
      limits:
        cpu: 750m
        ephemeral-storage: 1Gi
        memory: 768Mi
      requests:
        cpu: 750m
        ephemeral-storage: 1Gi
        memory: 768Mi
</code></pre>
<p>Any idea what's going on here? Why has GKE scaled up the resources. This is costing me more money unnecessarily?</p>
<p>Interestingly it was working as intended until recently. This behaviour only seemed to start in the past few days.</p>

harryg
<p>If the resources that you've requested are following:</p>
<pre><code>              memory: &quot;250Mi&quot;
              cpu: &quot;512m&quot;
</code></pre>
<p>Then they are not compliant with the minimal amount of resources that <code>GKE Autopilot</code> will assign. Please take a look on the documentation:</p>
<blockquote>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>NAME</th>
<th>Normal Pods</th>
</tr>
</thead>
<tbody>
<tr>
<td>CPU</td>
<td>250 mCPU</td>
</tr>
<tr>
<td>Memory</td>
<td><strong>512 MiB</strong></td>
</tr>
<tr>
<td>Ephemeral storage</td>
<td>10 MiB (per container)</td>
</tr>
</tbody>
</table>
</div>
<p>-- <em><a href="https://cloud.google.com/kubernetes-engine/docs/concepts/autopilot-overview#allowable_resource_ranges" rel="noreferrer">Cloud.google.com: Kubernetes Engine: Docs: Concepts: Autopilot overview: Allowable resource ranges</a></em></p>
</blockquote>
<p><strong>As you can see the amount of memory you've requested was too small</strong> and that's why you saw the following message (and the manifest was modified to increate the <code>requests</code>/<code>limits</code>):</p>
<pre class="lang-sh prettyprint-override"><code>Warning: Autopilot increased resource requests for Deployment default/XYZ to meet requirements. See http://g.co/gke/autopilot-resources.
</code></pre>
<p>To fix that you will need to assign resources that are within the limits of the documentation, I've included in the link above.</p>
