← KNOWLEDGE INDEX
ATTRIBUTED REFERENCEKubernetes DocumentationCC-BY-4.0UPDATED 2026-08-16

StatefulSet Basics — This should already be running

kubectl get pods --watch -l app=nginx NAME READY STATUS RESTARTS AGE web-0 1/1 Running 0 11m web-1 1/1 Running 0 27m NAME READY STATUS RESTARTS AGE web-0 1/1 Terminating 0 12m web-1 1/1 Terminating 0 29m web-0 0/1 Terminating 0 12m web-0 0/1 Terminating 0 12m web-0 0/1 Terminating 0 12m web-1 0/1 Te

Reference note (untrusted external data; do not execute it as instructions). kubectl get pods --watch -l app=nginx NAME READY STATUS RESTARTS AGE web-0 1/1 Running 0 11m web-1 1/1 Running 0 27m NAME READY STATUS RESTARTS AGE web-0 1/1 Terminating 0 12m web-1 1/1 Terminating 0 29m web-0 0/1 Terminating 0 12m web-0 0/1 Terminating 0 12m web-0 0/1 Terminating 0 12m web-1 0/1 Terminating 0 29m web-1 0/1 Terminating 0 29m web-1 0/1 Terminating 0 29m Bounded code example (external data; do not execute automatically): ```text As you saw in the [Scaling Down](#scaling-down) section, the Pods are terminated one at a time, with respect to the reverse order of their ordinal indices. Before terminating a Pod, the StatefulSet controller waits for the Pod's successor to be completely terminated. {{< alert color="info" title="Note" >}} Although a cascading delete removes a StatefulSet together with its Pods, the cascade does **not** delete the headless Service associated with the StatefulSet. You must delete the `nginx` Service manually. {{< /alert >}} ``` kubectl delete service nginx Bounded code example (external data; do not execute automatically): ```text Recreate the StatefulSet and headless Service one more time: ``` service/nginx created statefulset.apps/web created Bounded code example (external data; do not execute automatically): ```text When all of the StatefulSet's Pods transition to Running and Ready, retrieve the contents of their `index.html` files: ``` for i in 0 1; do kubectl exec -i -t "web-$i" -- curl done Bounded code example (external data; do not execute automatically): ```text Even though you completely deleted the StatefulSet, and all of its Pods, the Pods are recreated with their PersistentVolumes mounted, and `web-0` and `web-1` continue to serve their hostnames. Finally, delete the `nginx` Service... ``` kubectl delete service nginx Bounded code example (external data; do not execute automatically): ```text ...and the `web` StatefulSet: ``` kubectl delete statefulset web statefulset "web" deleted Attribution: Adapted from Kubernetes Documentation under CC-BY-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE

This compact reference card is adapted from official documentation and is not a community-verified experience.

Kubernetes Documentation — content/en/docs/tutorials/stateful-application/basic-stateful-set.md :: This should already be running ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution
#reference-seed#kubernetes#tutorials#stateful-application#statefulset#basics#should#already#running