You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/concepts/workloads/controllers/replicaset.md
+8-6
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ use a Deployment instead, and define your application in the spec section.
51
51
52
52
{% include code.html language="yaml" file="frontend.yaml" ghlink="/docs/concepts/workloads/controllers/frontend.yaml" %}
53
53
54
-
Saving this config into `frontend.yaml` and submitting it to a Kubernetes cluster should
54
+
Saving this manifest into `frontend.yaml` and submitting it to a Kubernetes cluster should
55
55
create the defined ReplicaSet and the pods that it manages.
56
56
57
57
```shell
@@ -95,8 +95,8 @@ frontend-qhloh 1/1 Running 0 1m
95
95
96
96
## Writing a ReplicaSet Spec
97
97
98
-
As with all other Kubernetes config, a ReplicaSet needs the `apiVersion`, `kind`, and `metadata` fields. For
99
-
general information about working with config files, see [here](/docs/user-guide/simple-yaml/),
98
+
As with all other Kubernetes API objects, a ReplicaSet needs the `apiVersion`, `kind`, and `metadata` fields. For
99
+
general information about working with manifests, see [here](/docs/user-guide/simple-yaml/),
100
100
[here](/docs/user-guide/configuring-containers/), and [here](/docs/concepts/tools/kubectl/object-management-overview/).
101
101
102
102
A ReplicaSet also needs a [`.spec` section](https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status).
@@ -124,11 +124,13 @@ manages all the pods with labels that match the selector. It does not distinguis
124
124
between pods that it created or deleted and pods that another person or process created or
125
125
deleted. This allows the ReplicaSet to be replaced without affecting the running pods.
126
126
127
-
The `.spec.template.metadata.labels` must be equal to the `.spec.selector`, or it will
127
+
The `.spec.template.metadata.labels` must match the `.spec.selector`, or it will
128
128
be rejected by the API.
129
129
130
+
In Kubernetes 1.8 or later, `.spec.selector` and `.metadata.labels` no longer default to `.spec.template.metadata.labels` if not set. So they must be set explicitly. Also note that `.spec.selector` is immutable after creation in Kubernetes 1.8 or later.
131
+
130
132
Also you should not normally create any pods whose labels match this selector, either directly, with
131
-
another ReplicaSet, or with another controller such as Job. If you do so, the ReplicaSet thinks that it
133
+
another ReplicaSet, or with another controller such as Deployment. If you do so, the ReplicaSet thinks that it
132
134
created the other pods. Kubernetes does not stop you from doing this.
133
135
134
136
If you do end up with multiple controllers that have overlapping selectors, you
@@ -192,7 +194,7 @@ the ReplicaSet we created in the previous example.
192
194
193
195
{% include code.html language="yaml" file="hpa-rs.yaml" ghlink="/docs/concepts/workloads/controllers/hpa-rs.yaml" %}
194
196
195
-
Saving this config into `hpa-rs.yaml` and submitting it to a Kubernetes cluster should
197
+
Saving this manifest into `hpa-rs.yaml` and submitting it to a Kubernetes cluster should
196
198
create the defined HPA that autoscales the target ReplicaSet depending on the CPU usage
0 commit comments