Hey @ Liana, You could use Horizontal Pod Autoscaler for this purpose.
-
It would scale all of them, internally the deployment creates a replica set (which does the scaling), and then a set number of pods are made by that replica set.
-
The pod is what actually holds both of those containers. and if you want to scale them independently they should be separate pods (and therefore replica sets, deployments, etc).
-
So for Horizontal Pod Autoscaler to work you need to specify min and max replicas and the threshold what percentage of cpu and memory you want your pods to autoscale..without having the manually run kubectl autoscale deployment.
-
you can use the below yaml file to do the same.
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
annotations:
name: app
spec:
maxReplicas: 15
minReplicas: 10
scaleTargetRef:
apiVersion: autoscaling/v1
kind: Deployment
name: app targetCPUUtilizationPercentage: 70