Ordered cleanup with OwnerReference
The Memcached controller creates pods containing OwnerReferences
in their metadata
section. Referencing their owner ensures they will be deleted when the `memcached-sample` CR is deleted.
You can see the OwnerReference set on any of Memcached's pods:
kubectl get pods -o yaml | grep ownerReferences -A10
Delete the memcached-sample
Custom Resource:
kubectl delete memcached memcached-sample
Thanks to OwnerReferences, all of the pods should be deleted. You can check with the familiar kubectl get pods
.