Merge pull request #34116 from TheRealDwright/update-docs-labels
update docs labels
This commit is contained in:
@@ -63,7 +63,7 @@ DNS server watches the Kubernetes API for new `Services` and creates a set of DN
|
|||||||
|
|
||||||
## Using Labels
|
## Using Labels
|
||||||
|
|
||||||
- Define and use [labels](/docs/concepts/overview/working-with-objects/labels/) that identify __semantic attributes__ of your application or Deployment, such as `{ app: myapp, tier: frontend, phase: test, deployment: v3 }`. You can use these labels to select the appropriate Pods for other resources; for example, a Service that selects all `tier: frontend` Pods, or all `phase: test` components of `app: myapp`. See the [guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) app for examples of this approach.
|
- Define and use [labels](/docs/concepts/overview/working-with-objects/labels/) that identify __semantic attributes__ of your application or Deployment, such as `{ app.kubernetes.io/name: MyApp, tier: frontend, phase: test, deployment: v3 }`. You can use these labels to select the appropriate Pods for other resources; for example, a Service that selects all `tier: frontend` Pods, or all `phase: test` components of `app.kubernetes.io/name: MyApp`. See the [guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) app for examples of this approach.
|
||||||
|
|
||||||
A Service can be made to span multiple Deployments by omitting release-specific labels from its selector. When you need to update a running service without downtime, use a [Deployment](/docs/concepts/workloads/controllers/deployment/).
|
A Service can be made to span multiple Deployments by omitting release-specific labels from its selector. When you need to update a running service without downtime, use a [Deployment](/docs/concepts/workloads/controllers/deployment/).
|
||||||
|
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ dual-stack.)
|
|||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
name: my-service
|
name: my-service
|
||||||
spec:
|
spec:
|
||||||
clusterIP: 10.0.197.123
|
clusterIP: 10.0.197.123
|
||||||
@@ -188,7 +188,7 @@ dual-stack.)
|
|||||||
protocol: TCP
|
protocol: TCP
|
||||||
targetPort: 80
|
targetPort: 80
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
status:
|
status:
|
||||||
loadBalancer: {}
|
loadBalancer: {}
|
||||||
@@ -214,7 +214,7 @@ dual-stack.)
|
|||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
name: my-service
|
name: my-service
|
||||||
spec:
|
spec:
|
||||||
clusterIP: None
|
clusterIP: None
|
||||||
@@ -228,7 +228,7 @@ dual-stack.)
|
|||||||
protocol: TCP
|
protocol: TCP
|
||||||
targetPort: 80
|
targetPort: 80
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Switching Services between single-stack and dual-stack
|
#### Switching Services between single-stack and dual-stack
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ metadata:
|
|||||||
name: my-service
|
name: my-service
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
ports:
|
ports:
|
||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ The name of a Service object must be a valid
|
|||||||
[RFC 1035 label name](/docs/concepts/overview/working-with-objects/names#rfc-1035-label-names).
|
[RFC 1035 label name](/docs/concepts/overview/working-with-objects/names#rfc-1035-label-names).
|
||||||
|
|
||||||
For example, suppose you have a set of Pods where each listens on TCP port 9376
|
For example, suppose you have a set of Pods where each listens on TCP port 9376
|
||||||
and contains a label `app=MyApp`:
|
and contains a label `app.kubernetes.io/name=MyApp`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
@@ -84,7 +84,7 @@ metadata:
|
|||||||
name: my-service
|
name: my-service
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
ports:
|
ports:
|
||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
@@ -92,7 +92,7 @@ spec:
|
|||||||
```
|
```
|
||||||
|
|
||||||
This specification creates a new Service object named "my-service", which
|
This specification creates a new Service object named "my-service", which
|
||||||
targets TCP port 9376 on any Pod with the `app=MyApp` label.
|
targets TCP port 9376 on any Pod with the `app.kubernetes.io/name=MyApp` label.
|
||||||
|
|
||||||
Kubernetes assigns this Service an IP address (sometimes called the "cluster IP"),
|
Kubernetes assigns this Service an IP address (sometimes called the "cluster IP"),
|
||||||
which is used by the Service proxies
|
which is used by the Service proxies
|
||||||
@@ -423,7 +423,7 @@ metadata:
|
|||||||
name: my-service
|
name: my-service
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
@@ -666,7 +666,7 @@ metadata:
|
|||||||
spec:
|
spec:
|
||||||
type: NodePort
|
type: NodePort
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
ports:
|
ports:
|
||||||
# By default and for convenience, the `targetPort` is set to the same value as the `port` field.
|
# By default and for convenience, the `targetPort` is set to the same value as the `port` field.
|
||||||
- port: 80
|
- port: 80
|
||||||
@@ -692,7 +692,7 @@ metadata:
|
|||||||
name: my-service
|
name: my-service
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
ports:
|
ports:
|
||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
@@ -1263,7 +1263,7 @@ metadata:
|
|||||||
name: my-service
|
name: my-service
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
@@ -1481,4 +1481,3 @@ followed by the data from the client.
|
|||||||
* Read [Connecting Applications with Services](/docs/concepts/services-networking/connect-applications-service/)
|
* Read [Connecting Applications with Services](/docs/concepts/services-networking/connect-applications-service/)
|
||||||
* Read about [Ingress](/docs/concepts/services-networking/ingress/)
|
* Read about [Ingress](/docs/concepts/services-networking/ingress/)
|
||||||
* Read about [EndpointSlices](/docs/concepts/services-networking/endpoint-slices/)
|
* Read about [EndpointSlices](/docs/concepts/services-networking/endpoint-slices/)
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ kind: Pod
|
|||||||
metadata:
|
metadata:
|
||||||
name: myapp-pod
|
name: myapp-pod
|
||||||
labels:
|
labels:
|
||||||
app: myapp
|
app.kubernetes.io/name: MyApp
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: myapp-container
|
- name: myapp-container
|
||||||
@@ -159,7 +159,7 @@ The output is similar to this:
|
|||||||
Name: myapp-pod
|
Name: myapp-pod
|
||||||
Namespace: default
|
Namespace: default
|
||||||
[...]
|
[...]
|
||||||
Labels: app=myapp
|
Labels: app.kubernetes.io/name=MyApp
|
||||||
Status: Pending
|
Status: Pending
|
||||||
[...]
|
[...]
|
||||||
Init Containers:
|
Init Containers:
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ This task shows you how to debug a StatefulSet.
|
|||||||
|
|
||||||
## Debugging a StatefulSet
|
## Debugging a StatefulSet
|
||||||
|
|
||||||
In order to list all the pods which belong to a StatefulSet, which have a label `app=myapp` set on them,
|
In order to list all the pods which belong to a StatefulSet, which have a label `app.kubernetes.io/name=MyApp` set on them,
|
||||||
you can use the following:
|
you can use the following:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl get pods -l app=myapp
|
kubectl get pods -l app.kubernetes.io/name=MyApp
|
||||||
```
|
```
|
||||||
|
|
||||||
If you find that any Pods listed are in `Unknown` or `Terminating` state for an extended period of time,
|
If you find that any Pods listed are in `Unknown` or `Terminating` state for an extended period of time,
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ spec:
|
|||||||
protocol: TCP
|
protocol: TCP
|
||||||
targetPort: 9376
|
targetPort: 9376
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
sessionAffinity: None
|
sessionAffinity: None
|
||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
status:
|
status:
|
||||||
@@ -158,7 +158,7 @@ apiVersion: v1
|
|||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
name: my-service
|
name: my-service
|
||||||
spec:
|
spec:
|
||||||
clusterIP: fd00::5118
|
clusterIP: fd00::5118
|
||||||
@@ -172,7 +172,7 @@ spec:
|
|||||||
protocol: TCP
|
protocol: TCP
|
||||||
targetPort: 80
|
targetPort: 80
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
sessionAffinity: None
|
sessionAffinity: None
|
||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
status:
|
status:
|
||||||
@@ -187,7 +187,7 @@ Create the following Service that explicitly defines `PreferDualStack` in `.spec
|
|||||||
The `kubectl get svc` command will only show the primary IP in the `CLUSTER-IP` field.
|
The `kubectl get svc` command will only show the primary IP in the `CLUSTER-IP` field.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl get svc -l app=MyApp
|
kubectl get svc -l app.kubernetes.io/name=MyApp
|
||||||
|
|
||||||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||||
my-service ClusterIP 10.0.216.242 <none> 80/TCP 5s
|
my-service ClusterIP 10.0.216.242 <none> 80/TCP 5s
|
||||||
@@ -197,15 +197,15 @@ my-service ClusterIP 10.0.216.242 <none> 80/TCP 5s
|
|||||||
Validate that the Service gets cluster IPs from the IPv4 and IPv6 address blocks using `kubectl describe`. You may then validate access to the service via the IPs and ports.
|
Validate that the Service gets cluster IPs from the IPv4 and IPv6 address blocks using `kubectl describe`. You may then validate access to the service via the IPs and ports.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl describe svc -l app=MyApp
|
kubectl describe svc -l app.kubernetes.io/name=MyApp
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
Name: my-service
|
Name: my-service
|
||||||
Namespace: default
|
Namespace: default
|
||||||
Labels: app=MyApp
|
Labels: app.kubernetes.io/name=MyApp
|
||||||
Annotations: <none>
|
Annotations: <none>
|
||||||
Selector: app=MyApp
|
Selector: app.kubernetes.io/name=MyApp
|
||||||
Type: ClusterIP
|
Type: ClusterIP
|
||||||
IP Family Policy: PreferDualStack
|
IP Family Policy: PreferDualStack
|
||||||
IP Families: IPv4,IPv6
|
IP Families: IPv4,IPv6
|
||||||
@@ -227,7 +227,7 @@ If the cloud provider supports the provisioning of IPv6 enabled external load ba
|
|||||||
Check the Service:
|
Check the Service:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl get svc -l app=MyApp
|
kubectl get svc -l app.kubernetes.io/name=MyApp
|
||||||
```
|
```
|
||||||
|
|
||||||
Validate that the Service receives a `CLUSTER-IP` address from the IPv6 address block along with an `EXTERNAL-IP`. You may then validate access to the service via the IP and port.
|
Validate that the Service receives a `CLUSTER-IP` address from the IPv6 address block along with an `EXTERNAL-IP`. You may then validate access to the service via the IP and port.
|
||||||
|
|||||||
@@ -50,10 +50,10 @@ For example:
|
|||||||
kubectl delete -f <file.yaml> --cascade=orphan
|
kubectl delete -f <file.yaml> --cascade=orphan
|
||||||
```
|
```
|
||||||
|
|
||||||
By passing `--cascade=orphan` to `kubectl delete`, the Pods managed by the StatefulSet are left behind even after the StatefulSet object itself is deleted. If the pods have a label `app=myapp`, you can then delete them as follows:
|
By passing `--cascade=orphan` to `kubectl delete`, the Pods managed by the StatefulSet are left behind even after the StatefulSet object itself is deleted. If the pods have a label `app.kubernetes.io/name=MyApp`, you can then delete them as follows:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl delete pods -l app=myapp
|
kubectl delete pods -l app.kubernetes.io/name=MyApp
|
||||||
```
|
```
|
||||||
|
|
||||||
### Persistent Volumes
|
### Persistent Volumes
|
||||||
@@ -70,13 +70,13 @@ To delete everything in a StatefulSet, including the associated pods, you can ru
|
|||||||
|
|
||||||
```shell
|
```shell
|
||||||
grace=$(kubectl get pods <stateful-set-pod> --template '{{.spec.terminationGracePeriodSeconds}}')
|
grace=$(kubectl get pods <stateful-set-pod> --template '{{.spec.terminationGracePeriodSeconds}}')
|
||||||
kubectl delete statefulset -l app=myapp
|
kubectl delete statefulset -l app.kubernetes.io/name=MyApp
|
||||||
sleep $grace
|
sleep $grace
|
||||||
kubectl delete pvc -l app=myapp
|
kubectl delete pvc -l app.kubernetes.io/name=MyApp
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
In the example above, the Pods have the label `app=myapp`; substitute your own label as appropriate.
|
In the example above, the Pods have the label `app.kubernetes.io/name=MyApp`; substitute your own label as appropriate.
|
||||||
|
|
||||||
### Force deletion of StatefulSet pods
|
### Force deletion of StatefulSet pods
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ kind: Service
|
|||||||
metadata:
|
metadata:
|
||||||
name: my-service
|
name: my-service
|
||||||
labels:
|
labels:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
ports:
|
ports:
|
||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ kind: Service
|
|||||||
metadata:
|
metadata:
|
||||||
name: my-service
|
name: my-service
|
||||||
labels:
|
labels:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
spec:
|
spec:
|
||||||
ipFamilies:
|
ipFamilies:
|
||||||
- IPv6
|
- IPv6
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
ports:
|
ports:
|
||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ metadata:
|
|||||||
spec:
|
spec:
|
||||||
ipFamily: IPv6
|
ipFamily: IPv6
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
ports:
|
ports:
|
||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ kind: Service
|
|||||||
metadata:
|
metadata:
|
||||||
name: my-service
|
name: my-service
|
||||||
labels:
|
labels:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
spec:
|
spec:
|
||||||
ipFamilyPolicy: PreferDualStack
|
ipFamilyPolicy: PreferDualStack
|
||||||
ipFamilies:
|
ipFamilies:
|
||||||
- IPv6
|
- IPv6
|
||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
ports:
|
ports:
|
||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ kind: Service
|
|||||||
metadata:
|
metadata:
|
||||||
name: my-service
|
name: my-service
|
||||||
labels:
|
labels:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
spec:
|
spec:
|
||||||
ipFamilyPolicy: PreferDualStack
|
ipFamilyPolicy: PreferDualStack
|
||||||
ipFamilies:
|
ipFamilies:
|
||||||
- IPv6
|
- IPv6
|
||||||
- IPv4
|
- IPv4
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
ports:
|
ports:
|
||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ kind: Service
|
|||||||
metadata:
|
metadata:
|
||||||
name: my-service
|
name: my-service
|
||||||
labels:
|
labels:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
spec:
|
spec:
|
||||||
ipFamilyPolicy: PreferDualStack
|
ipFamilyPolicy: PreferDualStack
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app.kubernetes.io/name: MyApp
|
||||||
ports:
|
ports:
|
||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
|
|||||||
Reference in New Issue
Block a user