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
• 8,200 points
389 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
• 45,960 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
492 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
• 45,960 points
293 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
• 45,960 points
318 views
0 votes
1 answer
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, 2019 in Others by anonymous
4,314 views
+3 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 11, 2019 in Kubernetes by Kalgi
• 50,840 points

reshown Apr 12, 2019 by Kalgi 1,164 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
• 45,960 points
214 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
• 45,960 points
70 views