Kubernetes – cascading deletion

In the Kubernetes world there are basically three cascading deletion flavours:
– background (DEFAULT)
– foreground
– orphan

Background

This strategy deletes the resource itself and all their dependants recursively down immediately (doesn’t wait for dependants to be deleted first). And as it is the default cascading strategy you don’t need to specify it, for example:

kubectl delete deployment myapp-deployment

Foreground

This strategy is very similar to background deletion – the only difference is that it waits for all its dependants to be deleted first:

kubectl delete deployment myapp-deployment --cascade=foreground

Orphan

If you want to remove the resource without deleting the dependants (leaving them as orphans) you should use the orphan strategy:

kubectl delete deployment myapp-deployment --cascade=orphan

Worth reading

  1. https://kubernetes.io/docs/tasks/administer-cluster/use-cascading-deletion/

Pozostaw komentarz

Twój adres e-mail nie zostanie opublikowany. Wymagane pola są oznaczone *