Adding example to show labels in POD yaml (#14439)
* Adding example to show labels in POD yaml This page talk about labels and its usage. Also it talk about syntax for specifying labels. But it does not show how we can have labels in resource manifest. So with this PR i am adding example which shows that how we can have labels in pod manifest. * Changes to resolve review comments Changes to resolve review commentspull/14765/head
parent
0e146f8df5
commit
6b9fd618b2
|
@ -55,6 +55,26 @@ The `kubernetes.io/` and `k8s.io/` prefixes are reserved for Kubernetes core com
|
|||
|
||||
Valid label values must be 63 characters or less and must be empty or begin and end with an alphanumeric character (`[a-z0-9A-Z]`) with dashes (`-`), underscores (`_`), dots (`.`), and alphanumerics between.
|
||||
|
||||
For example, here’s the configuration file for a Pod that has two labels `environment: production` and `app: nginx` :
|
||||
|
||||
```yaml
|
||||
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: label-demo
|
||||
labels:
|
||||
environment: production
|
||||
app: nginx
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:1.7.9
|
||||
ports:
|
||||
- containerPort: 80
|
||||
|
||||
```
|
||||
|
||||
## Label selectors
|
||||
|
||||
Unlike [names and UIDs](/docs/user-guide/identifiers), labels do not provide uniqueness. In general, we expect many objects to carry the same label(s).
|
||||
|
|
Loading…
Reference in New Issue