Skip to content
Permalink
Browse files

Tweak StatefulSet concept page for YAML rendering (#17891)

for: #17792
  • Loading branch information
tengqm authored and k8s-ci-robot committed Dec 1, 2019
1 parent 459fe87 commit 9270ebfa5ac8433cb1feecd2ed40b01ca3ad6091
Showing with 7 additions and 4 deletions.
  1. +7 −4 content/en/docs/concepts/workloads/controllers/statefulset.md
@@ -49,11 +49,8 @@ that provides a set of stateless replicas.
[manual intervention to repair](#forced-rollback).

## Components
The example below demonstrates the components of a StatefulSet.

* A Headless Service, named nginx, is used to control the network domain.
* The StatefulSet, named web, has a Spec that indicates that 3 replicas of the nginx container will be launched in unique Pods.
* The volumeClaimTemplates will provide stable storage using [PersistentVolumes](/docs/concepts/storage/persistent-volumes/) provisioned by a PersistentVolume Provisioner.
The example below demonstrates the components of a StatefulSet.

```yaml
apiVersion: v1
@@ -106,6 +103,12 @@ spec:
storage: 1Gi
```

In the above example:

* A Headless Service, named `nginx`, is used to control the network domain.
* The StatefulSet, named `web`, has a Spec that indicates that 3 replicas of the nginx container will be launched in unique Pods.
* The `volumeClaimTemplates` will provide stable storage using [PersistentVolumes](/docs/concepts/storage/persistent-volumes/) provisioned by a PersistentVolume Provisioner.

## Pod Selector
You must set the `.spec.selector` field of a StatefulSet to match the labels of its `.spec.template.metadata.labels`. Prior to Kubernetes 1.8, the `.spec.selector` field was defaulted when omitted. In 1.8 and later versions, failing to specify a matching Pod Selector will result in a validation error during StatefulSet creation.

0 comments on commit 9270ebf

Please sign in to comment.
You can’t perform that action at this time.