kubectl StatefulSets commands

15 commands in 3 groups: Manage, Rollout, List & Inspect. Click or tap any command to copy it. Official documentation: kubernetes.io.

Open in the interactive cheat sheet search, stars and every other section

Manage

Create, update, scale, and delete StatefulSets and their associated pods.
kubectl apply -f statefulset.yaml
Apply StatefulSet from manifest
kubectl delete statefulset <name>
Delete a StatefulSet
kubectl delete statefulset <name> --cascade=orphan
Delete StatefulSet, keep its pods
kubectl edit statefulset <name>
Edit StatefulSet in $EDITOR
kubectl scale statefulset/<name> --replicas=<n>
Scale to N replicas

Rollout

Track, restart, and roll back StatefulSet updates.
kubectl rollout history statefulset/<name>
Show revision history
kubectl rollout restart statefulset/<name>
Trigger a rolling restart
kubectl rollout status statefulset/<name>
Watch rollout progress
kubectl rollout undo statefulset/<name>
Rollback to previous revision

List & Inspect

View StatefulSets and their replica count, age, and current state.
kubectl describe statefulset <name>
Full StatefulSet details and events
kubectl get statefulsets
List StatefulSets in current namespace
kubectl get sts
Short alias for get statefulsets
kubectl get statefulset <name> -o yaml
Get StatefulSet manifest as YAML
kubectl get statefulsets -A
All StatefulSets across namespaces
kubectl get statefulsets -n <namespace>
StatefulSets in a specific namespace