Ownership: follow object UIDs through dependent lifecycles
Separate labels from ownership, apply namespace rules, and reason about foreground, background, and orphan deletion.
On this page
The question for today
What you’ll understand
- Match an owner reference to the correct immutable object incarnation.
- Explain valid namespaced and cluster-scoped ownership relationships.
- Distinguish deletion propagation policies and foreground blockers.
A label can group objects, but it does not make one object responsible for another’s lifecycle. Kubernetes owner references express the ownership relationship used by garbage collection and controllers. The owner’s UID matters because names can be reused. Understanding that distinction prevents a new resource with an old name from accidentally inheriting or deleting dependents created for a previous incarnation.
Ownership is an identity relationship
An owner reference identifies an API object using fields including its kind, name, and UID. A controller must verify the referenced incarnation rather than matching only a name or selector. Labels and selectors help discover candidates but can be edited and are not a replacement for ownership checks. A dependent may have multiple owner references, while the controlling-owner relationship has its own uniqueness constraints. Adoption of an existing object therefore needs an explicit rule; finding a matching label is not sufficient permission to claim it.
The namespace rules constrain the ownership graph. A namespaced dependent can reference a namespaced owner in the same namespace or an allowed cluster-scoped owner. A namespaced owner in another namespace is not a valid cross-namespace ownership link. A cluster-scoped dependent cannot validly depend on a namespaced owner; the documented v1.34 behavior treats that kind of reference as unresolvable for garbage collection. Invalid references can produce warning events, and different invalid cases should not be collapsed into an assumption that every such object is immediately deleted.
Deletion propagation is a deliberate policy
Background deletion can remove the owner while garbage collection handles dependents asynchronously. Foreground deletion keeps the owner in a deletion state until the relevant blocking dependents are handled. Orphan propagation preserves dependents by removing the ownership relationship rather than deleting the dependent objects. These policies govern API object relationships; they do not directly guarantee an external cloud resource was cleaned up. A dependent’s own finalizers can also delay its disappearance after a delete request.
Foreground blocking specifically concerns dependents with the appropriate blockOwnerDeletion reference that the garbage collector knows about under its documented behavior. Do not assume every matching label, every new dependent created concurrently, or every inaccessible resource automatically blocks the owner. Garbage collection depends on discovery, watches, permissions, and its own working state. If an owner appears stuck, inspect actual reference UIDs, scopes, finalizers, blocking flags, and events before removing metadata. Correct lifecycle debugging follows the graph and its conditions, not a guessed name hierarchy.
Creation and adoption must respect deletion races
A controller should avoid creating new dependents for an owner already marked for deletion. When it creates or adopts a dependent, set a valid owner reference for the observed UID and preserve other required metadata using concurrency-aware updates. Recreating an owner with the same name yields a new UID, so old dependents are not automatically the new object’s responsibility. Define an explicit migration or adoption workflow if retention is desired. This is especially important for resources that also control durable storage or external identifiers.
The queue lab illustrates only the service cost of many independent deletion obligations. Reset, set λ=2 and μ=3, predict the initial four abstract jobs drain at t=4, then Play or Step. It has no ownership graph, UID matching, namespaces, finalizers, or foreground blockers. The analogy cannot tell you which dependents should be deleted. Use the graph trace below for lifecycle correctness, then use a capacity model to ask whether the responsible controllers can process the eligible work promptly.
Work it through
An old UID does not become a new owner
A namespaced owner has UID u1. In the same namespace, dependents X and Y reference u1 with blockOwnerDeletion=true. Z instead references an earlier owner UID u0 with the same name. Assume all references and objects are known to the garbage collector.
X and Y match the current owner incarnation, so there are two known blocking dependents for u1 under foreground deletion. Z’s name match does not compensate for its different UID.
If X is deleted but Y remains because of its own finalizer, one blocker for u1 remains. Removing the owner’s foreground wait while ignoring Y would change the requested lifecycle semantics.
Z belongs to the old reference history and needs its own valid garbage-collection or explicit adoption handling. Under orphan propagation for u1, X and Y would be retained with the relevant ownership links removed rather than being deleted by that propagation policy.
There are initially two blockers for u1, then one after X disappears. Reused names do not merge ownership between different UIDs.
The living notebook
Explore the model
Interactive lab · queue
Eligible cleanup still consumes capacity
Reset, set λ=2 and μ=3, predict backlog max(0,4−t), then Play or Step. This fluid queue models abstract work only; it does not determine ownership, namespace validity, foreground blocking, or orphan behavior.
- Fluid backlog
- 4
- Net rate · λ − μ
- −1 /s
- M/M/1 mean residence
- 1 s
Fluid backlog starts at 4 and follows max(0, 4 + (λ − μ)t). The separate M/M/1 residence-time formula assumes Poisson arrivals, exponential service and λ < μ. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forDetermine which cleanup is semantically eligible before estimating how quickly it can be serviced.
Pause & reason
Check your understanding
Your turn
Try it yourself
A current owner UID q has four discovered matching dependents. Three set blockOwnerDeletion=true, one does not. A fifth object shares the label but references another UID. How many blockers are in the stated foreground set?
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Apply both the UID match and blocking predicate; labels alone do not add an edge.
Compare with the solution
Three are in the defined blocker set. The nonblocking matching dependent can have its own lifecycle but is not counted by this predicate, and the label-only object with another UID is not owned by q. Real completion also depends on the garbage collector’s actual discovery and deletion conditions.
Keep the idea
Take it with you
- Owner UIDs distinguish lifecycles even when names are reused.
- Scope rules and valid references constrain the ownership graph.
- Foreground, background, and orphan propagation have different retention behavior.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.