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 comments
pull/14765/head
Rajesh Deshpande 2019-06-06 11:28:10 +05:30 committed by Kubernetes Prow Robot
parent 0e146f8df5
commit 6b9fd618b2
1 changed files with 20 additions and 0 deletions

View File

@ -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, heres 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).