K8S Garbage Collection
Cascading deletion: When deleting an object, one can specify whether the object's dependents are also deleted automatically. Deleting the dependents automatically is called cascading deletion.
Foreground cascading deletion
Root object first enters "deletion in progress" state
The object is still available via REST API
deletionTimestamp
is setmetadata.finalizers
contains the value offoregroundDeletion
Garbage collector deletes the object's dependents
Once the garbage collector has deleted all “blocking” dependents (objects with
ownerReference.blockOwnerDeletion=true
), it deletes the owner object. Otherwise the deletion of the objects will be blocked
Background cascading deletion
In background cascading deletion, Kubernetes deletes the owner object immediately and the garbage collector then deletes the dependents in the background.
Setting the cascading deletion policy
Checkout the link
References
Last updated