Tweak StatefulSet concept page for YAML rendering (#17891)

for: #17792
pull/17902/head
Qiming 2019-12-01 13:17:04 +08:00 committed by Kubernetes Prow Robot
parent 459fe87540
commit 9270ebfa5a
1 changed files with 7 additions and 4 deletions

View File

@ -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.