When will a kube object have more than one ownerReferences

1/15/2020

When a kubernetes object has parent objects, it is mentioned under "ownerReferences". For example when i printed a pod spec in yaml format, i see ownerReferences mentioned as follows:

  ownerReferences:
  - apiVersion: apps/v1
    blockOwnerDeletion: true
    controller: true
    kind: StatefulSet
    name: statefuleset-name
    uid: <uuid>
....

I see that ownerReferences is a list. Does anyone know when the ownerReferences will have more than one entries. I am not able to imagine a object having more than one owner.

-- Ramesh Kuppili
kubernetes
pod

1 Answer

1/16/2020

If I understand you correctly it is possible in some circumstances.

In this blog you can see an example of multiple ownerReferences. The blog explains garbage collection in K8s and shows that Multiple ownerReferences are possible:

Yes, you heard that right, now postgres-namespace can be owned by more than one database object.

I hope it helps.

-- OhHiMark
Source: StackOverflow