Skip to content

Commit

Permalink
Adding example to show labels in POD yaml (#14439)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rajeshdeshpande02 authored and k8s-ci-robot committed Jun 6, 2019
1 parent 0e146f8 commit 6b9fd61
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions content/en/docs/concepts/overview/working-with-objects/labels.md
Expand Up @@ -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).
Expand Down

0 comments on commit 6b9fd61

Please sign in to comment.