From 6b9fd618b2f33dbd1c55a4374dfd7cd3a6faa894 Mon Sep 17 00:00:00 2001 From: Rajesh Deshpande Date: Thu, 6 Jun 2019 11:28:10 +0530 Subject: [PATCH] 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 --- .../overview/working-with-objects/labels.md | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/content/en/docs/concepts/overview/working-with-objects/labels.md b/content/en/docs/concepts/overview/working-with-objects/labels.md index d2858af8db..e8ca6f02c8 100644 --- a/content/en/docs/concepts/overview/working-with-objects/labels.md +++ b/content/en/docs/concepts/overview/working-with-objects/labels.md @@ -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).