<p>With a Horizontal Pod <strong>Autoscaler</strong> implemented for the <strong>Deployment</strong> running a <strong>Pod</strong> with two different containers: <strong>Containers-A</strong> and <strong>Contaner-B</strong>, I want to make sure that it only scales the number of Containers-A. The number of Containers-B should always be the same and not being effected by the Pod's <strong>Autoscaler</strong>. I wonder if isolating the Container-B from Autoscaler would be possible. If so, how to achieve it?</p>

<pre><code>kubectl autoscale my-deployment --min=10 --max=15 --cpu-percent=80
</code></pre>

<p>As the name suggests <strong>"Horizontal Pod Autoscaler"</strong> scales pods, not containers.</p>

<p>However, I do not see a reason why you would want this behavior.</p>

<p><a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-overview/#understanding-pods" rel="noreferrer">You should have more than one container in a Pod only if those containers are tightly coupled together and need to share resources.</a>
The fact that you want to scale container A and B independently, tells me that those containers are not tightly coupled.</p>

<p>I would suggest the following approach:</p>

<ol>
<li><p>Deployment A that manages Pods with container A.
The Autoscaler will only scale the pods for this deployment.</p></li>
<li><p>Deployment B that manages Pods with container B. This deployment will not be affected by the autoscaler.</p></li>
</ol>
