Kubernetes: container scaling

0 votes
I have multiple containers in a deployment file.could you please explain how do I scale all those containers?
Jul 18 in Kubernetes by Liana
19 views

1 answer to this question.

0 votes

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

answered Jul 18 by Sirajul
• 29,340 points

Related Questions In Kubernetes

0 votes
1 answer

How to use gravitational teleport in a container/kubernetes environment?

You can use teleport to augment kubernetes ...READ MORE

answered Jun 28, 2018 in Kubernetes by ajs3033
• 7,280 points
355 views
0 votes
2 answers

Access Kubernetes api from within a pod container

wget version: KUBE_TOKEN=$(</var/run/secrets/kubernetes.io/serviceaccount/token) wget -vO- ...READ MORE

answered Aug 29, 2018 in Kubernetes by Nilesh
• 6,880 points
302 views
0 votes
2 answers

keep container running on Kubernetes

Try using this CMD in your Dockerfile: CMD exec /bin/bash ...READ MORE

answered Aug 30, 2018 in Kubernetes by Nilesh
• 6,880 points
1,238 views
0 votes
1 answer

kubernetes rollout triggered on scaling

when you update the pod template, the ...READ MORE

answered Sep 4, 2018 in Kubernetes by Kalgi
• 41,460 points
22 views
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17 in Others by anonymous
2,512 views
+3 votes
1 answer
0 votes
1 answer

What are the container hooks available in kubernetes?

The hooks enable Containers to be aware ...READ MORE

answered Jul 15 in Kubernetes by Sirajul
• 29,340 points
27 views
0 votes
1 answer

Kubernetes: What are the types of multi-container pod patterns?

Here are the different types of multi-container ...READ MORE

answered Jul 17 in Kubernetes by Sirajul
• 29,340 points
34 views