Interview Prep/Kubernetes/Pods & Workloads

What are ownerReferences and how does garbage collection use them?

IntermediateConceptPods & Workloads
Answer

Dependent objects (Pods, ReplicaSets) carry ownerReferences to their owner. When the owner is deleted, the garbage collector deletes dependents according to the propagation policy: background (default), foreground or orphan. This is why deleting a Deployment removes its ReplicaSets and Pods.

kubectl delete deploy web --cascade=orphan
All Kubernetes questions Roadmap: Kubernetes core

More on Pods & Workloads