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
6,616 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,225 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
817 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,360 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,440 points
4,432 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
14,574 views
+4 votes
1 answer

Installing Web UI (Dashboard):kubernetes-dashboard on main Ubuntu 16.04.6 LTS (Xenial Xerus) server

Follow these steps: $ kubeadm reset $ kubeadm init ...READ MORE

answered Apr 12, 2019 in Kubernetes by Kalgi
• 52,360 points

reshown Apr 12, 2019 by Kalgi 6,053 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
934 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
3,806 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