ownerReferences in K8S
For the definition of ownerReferences
in K8S, I won't duplicate it here. More details could be found here. Below is an example of the ownerReferences
field of a Pod which is created by a ReplicaSet.
Terminology
Owner: In the case of ReplicaSet
and Pod
, the owner of Pod
is ReplicaSet
.
Dependents: In the case of ReplicaSet
and Pod
, the Pod
is the dependent of ReplicaSet
.
Things you might be interested in
Cross-namespace owner references are disallowed by design
This means: 1) Namespace-scoped dependents can only specify owners in the same namespace, and owners that are cluster-scoped. 2) Cluster-scoped dependents can only specify cluster-scoped owners, but not namespace-scoped owners.
metadata.ownerReferences.controller: true
If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.
From the documentation, it says If true, this refrence points to the managing controller
. In other words, the owner. The Garbage Collector's behavior of current object is under the instruction of its owner. If controller:false
, the Garbage Collector manages the object freely.
Someone has asked this question here.
Why ownerReferences field is a slice
From the code, there could be multiple owners of this object. But need to do more research on the real world case.
Last updated