✦ For everyone, free.

Practical knowledge for real and everyday life

Home

Kubernetes Metadata Identity

Kubernetes Metadata Identity defines how entities are uniquely identified and managed within the Kubernetes ecosystem through structured labels and annotations.

Kubernetes Metadata Identity is the concept of what makes a given object "the same object" across time and across different components' perspectives, resolved through several distinct identity notions layered within an object's metadata — a human-meaningful name, a namespace scoping that name, and a machine-generated UID — each serving a different purpose and each answering "is this the same thing" under different circumstances that a single identity field could not satisfy on its own.


Why More Than One Notion of Identity Is Needed

The Limits of Name-Based Identity Alone

A name is meaningful and stable to a human reading a manifest, but names can be reused: an object can be deleted and a new, entirely unrelated object created under the identical name, namespace, and resource type, meaning name alone cannot answer "is this literally the same object instance I saw a moment ago" reliably across a delete-and-recreate cycle.

UID as the True Instance Identifier

metadata.uid exists specifically to answer that stricter question: assigned once at creation and never reused, even by a future object sharing the same name, a UID uniquely identifies one specific object instance across its entire existence, making it the correct field for anything that must distinguish "the same object, still alive" from "a different object that happens to share a name."


Composite Identity for Addressing

Name, Namespace, and Type Together

For the purpose of addressing an object through the API — constructing the URL to read, update, or delete it — identity is the composite of GroupVersionResource, namespace (for namespaced types), and name, since this is exactly the information needed to route a request to the correct object without any need to already know its UID in advance.

Why Addressing Identity Differs From Instance Identity

This composite addressing identity is what a client typically starts with (a manifest specifies name and namespace, not UID, since UID cannot be known before creation), while UID becomes relevant only once an object already exists and a client needs to verify or reference that specific instance going forward, which is why manifests are authored around name-based identity while system components like owner references key on UID.


Identity Across Time and Recreation

The Same Name, a Different Object

Because names are reusable, a controller or client that only tracked name would be fooled by a delete-and-recreate sequence into believing it was still observing the original object, when in fact an entirely new instance now occupies that name; owner references and similar cross-object tracking mechanisms deliberately record UID precisely to avoid this class of mistaken-identity bug.

resourceVersion as a Finer-Grained Temporal Marker

Within a single object's continuous existence (unbroken by deletion), resourceVersion provides a still finer notion of identity-over-time, distinguishing not different instances but different states of the same instance, which is what optimistic concurrency control and watch resumption both depend on.


Identity From the Perspective of Different Components

Controllers Tracking "Their" Objects

A controller reconciling objects it owns typically indexes its internal bookkeeping by UID rather than name, precisely so that a delete-and-recreate of a dependent object (perhaps performed manually by an operator, or as part of the controller's own replacement logic) is correctly recognized as a change in identity rather than mistaken for continuity of the original object.

Clients Resolving Human Intent

Conversely, a human operator or a manifest, working from name and namespace rather than an opaque UID they cannot know in advance, resolves identity the addressing way, trusting that the API server will route their request to whatever object currently holds that name — a deliberate asymmetry between how humans express identity and how the system internally verifies it.


Identity in Distributed, Eventually Consistent Contexts

Watchers Reconciling Identity From Event Streams

Because different components observe object changes through independent watch streams that may be processed at different times, correctly interpreting a sequence of ADDED, MODIFIED, and DELETED events for what is genuinely the same object instance (versus a coincidentally same-named replacement) depends on consistently keying that reconciliation logic by UID, not name, especially in scenarios involving rapid deletion and recreation.