Skip to content

Instantly share code, notes, and snippets.

@oke-py
Created May 18, 2020 02:01
Show Gist options
  • Save oke-py/332450fdfa459079184d4cfb1b1bd371 to your computer and use it in GitHub Desktop.
Save oke-py/332450fdfa459079184d4cfb1b1bd371 to your computer and use it in GitHub Desktop.
git diff upstream/release-1.15 master content/en/docs/concepts/overview/working-with-objects/names.md
diff --git a/content/en/docs/concepts/overview/working-with-objects/names.md b/content/en/docs/concepts/overview/working-with-objects/names.md
index dffff2d1a..01bb53b56 100644
--- a/content/en/docs/concepts/overview/working-with-objects/names.md
+++ b/content/en/docs/concepts/overview/working-with-objects/names.md
@@ -2,31 +2,59 @@
reviewers:
- mikedanese
- thockin
-title: Names
+title: Object Names and IDs
content_template: templates/concept
weight: 20
---
{{% capture overview %}}
-All objects in the Kubernetes REST API are unambiguously identified by a Name and a UID.
+Each object in your cluster has a [_Name_](#names) that is unique for that type of resource.
+Every Kubernetes object also has a [_UID_](#uids) that is unique across your whole cluster.
-For non-unique user-provided attributes, Kubernetes provides [labels](/docs/user-guide/labels) and [annotations](/docs/concepts/overview/working-with-objects/annotations/).
+For example, you can only have one Pod named `myapp-1234` within the same [namespace](/docs/concepts/overview/working-with-objects/namespaces/), but you can have one Pod and one Deployment that are each named `myapp-1234`.
-See the [identifiers design doc](https://git.k8s.io/community/contributors/design-proposals/architecture/identifiers.md) for the precise syntax rules for Names and UIDs.
+For non-unique user-provided attributes, Kubernetes provides [labels](/docs/concepts/overview/working-with-objects/labels/) and [annotations](/docs/concepts/overview/working-with-objects/annotations/).
{{% /capture %}}
-
{{% capture body %}}
## Names
{{< glossary_definition term_id="name" length="all" >}}
-By convention, the names of Kubernetes resources should be up to maximum length of 253 characters and consist of lower case alphanumeric characters, `-`, and `.`, but certain resources have more specific restrictions.
+Below are three types of commonly used name constraints for resources.
+
+### DNS Subdomain Names
+
+Most resource types require a name that can be used as a DNS subdomain name
+as defined in [RFC 1123](https://tools.ietf.org/html/rfc1123).
+This means the name must:
+
+- contain no more than 253 characters
+- contain only lowercase alphanumeric characters, '-' or '.'
+- start with an alphanumeric character
+- end with an alphanumeric character
+
+### DNS Label Names
+
+Some resource types require their names to follow the DNS
+label standard as defined in [RFC 1123](https://tools.ietf.org/html/rfc1123).
+This means the name must:
+
+- contain at most 63 characters
+- contain only lowercase alphanumeric characters or '-'
+- start with an alphanumeric character
+- end with an alphanumeric character
-For example, here’s the configuration file with a Pod name as `nginx-demo` and a Container name as `nginx`:
+### Path Segment Names
+
+Some resource types require their names to be able to be safely encoded as a
+path segment. In other words, the name may not be "." or ".." and the name may
+not contain "/" or "%".
+
+Here’s an example manifest for a Pod named `nginx-demo`.
```yaml
apiVersion: v1
@@ -36,13 +64,25 @@ metadata:
spec:
containers:
- name: nginx
- image: nginx:1.7.9
+ image: nginx:1.14.2
ports:
- containerPort: 80
```
+
+{{< note >}}
+Some resource types have additional restrictions on their names.
+{{< /note >}}
+
## UIDs
{{< glossary_definition term_id="uid" length="all" >}}
+Kubernetes UIDs are universally unique identifiers (also known as UUIDs).
+UUIDs are standardized as ISO/IEC 9834-8 and as ITU-T X.667.
+
+{{% /capture %}}
+{{% capture whatsnext %}}
+* Read about [labels](/docs/concepts/overview/working-with-objects/labels/) in Kubernetes.
+* See the [Identifiers and Names in Kubernetes](https://git.k8s.io/community/contributors/design-proposals/architecture/identifiers.md) design document.
{{% /capture %}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment