With a Horizontal Pod Autoscaler implemented for the Deployment running a Pod with two different containers: Containers-A and Contaner-B, 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 Autoscaler. I wonder if isolating the Container-B from Autoscaler would be possible. If so, how to achieve it?
kubectl autoscale my-deployment --min=10 --max=15 --cpu-percent=80
As the name suggests "Horizontal Pod Autoscaler" scales pods, not containers.
However, I do not see a reason why you would want this behavior.
You should have more than one container in a Pod only if those containers are tightly coupled together and need to share resources. The fact that you want to scale container A and B independently, tells me that those containers are not tightly coupled.
I would suggest the following approach:
Deployment A that manages Pods with container A. The Autoscaler will only scale the pods for this deployment.
Deployment B that manages Pods with container B. This deployment will not be affected by the autoscaler.