...

/

Deleting a Namespace and All Its Objects

Deleting a Namespace and All Its Objects

Learn how to delete the namespace and everything associated with it.

We'll cover the following...

Cascaded deletion

Another handy feature of the namespaces is their cascading effect. For example, if we delete the testing namespace, all the objects and the resources running inside it will be removed as well.

kubectl delete ns testing
kubectl -n testing get all

We delete the testing namespace and retrieve all the objects in it. If the resources were not deleted very quickly, the output will be as follows:

NAME READY STATUS RESTARTS AGE
po/go-demo-2-api-56dfb69dbd-8w6rf 0/1 Terminating 0 2m
po/go-demo-2-api-56dfb69dbd-hrr4b 0/1 Terminating 0 2m
po/go-demo-2-api-56dfb69dbd-ws855 0/1 Terminating 0 2m
po/go-demo-2-db-5b49cc946b-xdd6v 0/1 Terminating 0 2m

Note: If the output shows more objects, you were too fast. ...