how to scale a statefulset in kubernetes

0 votes
What's the process involved if I need to increase the number of replicas or in other words how do I scale the statefulsets in kubernetes?
Jul 23, 2019 in Kubernetes by Karan
• 19,610 points
7,311 views

1 answer to this question.

0 votes

Scaling StatefulSets :

  • Use kubectl to scale StatefulSets

  • First, find the StatefulSet you want to scale.

kubectl get statefulsets <stateful-set-name>
  • Change the number of replicas of your StatefulSet:

kubectl scale statefulsets <stateful-set-name> --replicas=<new-replicas>

Make in-place updates on your StatefulSets

  • Alternatively, you can do in-place updates on your StatefulSets.

  • If your StatefulSet was initially created with kubectl apply, update .spec.replicas of the StatefulSet manifests, and then do a kubectl apply:

kubectl apply -f <stateful-set-file-updated>
  • Otherwise, edit that field with kubectl edit:

kubectl edit statefulsets <stateful-set-name>
  • Or use kubectl patch:

kubectl patch statefulsets <stateful-set-name> -p '{"spec":{"replicas":<new-replicas>}}'
answered Jul 23, 2019 by Sirajul
• 59,230 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,300 points
2,497 views
+1 vote
1 answer

How to deploy a feature with zero downtime in kubernetes?

By default Deployment in Kubernetes uses RollingUpdate as a ...READ MORE

answered Jul 18, 2019 in Kubernetes by Sirajul
• 59,230 points
1,030 views
+1 vote
1 answer

How to use a Volume to communicate between two Containers running in the same Kubernetes-Pod?

Create a Pod that runs two Containers Create a ...READ MORE

answered Jul 23, 2019 in Kubernetes by Sirajul
• 59,230 points
2,602 views
0 votes
1 answer

How to copy file inside a Pod in Kubernetes?

Hi@akhtar, You need to use the kubectl cp command ...READ MORE

answered Jul 5, 2020 in Kubernetes by MD
• 95,460 points
4,779 views
+1 vote
1 answer
0 votes
3 answers

Error while joining cluster with node

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

answered Jan 17, 2019 in Others by anonymous
15,577 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,062 views
0 votes
1 answer

How to build a high availability cluster in Kubernetes?

Add nodes in a HA cluster in ...READ MORE

answered Jul 12, 2019 in Kubernetes by Sirajul
• 59,230 points
1,246 views
0 votes
1 answer

how to test a manifest without actually executing it in kubernetes?

You can use --dry-run flag to test the manifest.  This ...READ MORE

answered Jul 18, 2019 in Kubernetes by Sirajul
• 59,230 points
4,229 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP