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 in Kubernetes by Karan
• 6,650 points
231 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 by Sirajul
• 40,980 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
423 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 in Kubernetes by Sirajul
• 40,980 points
275 views
+1 vote
1 answer
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 in Others by anonymous
3,347 views
+3 votes
1 answer
0 votes
1 answer
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 in Kubernetes by Sirajul
• 40,980 points
52 views