Understanding Immortal Namespaces in Kubernetes
β Bibin Wilson
The default namespace in Kubernetes cannot be deleted because it's a fundamental part of the system.
The logic for preventing the deletion of the default namespace is implemented in the Kubernetes source code.
Specifically, this logic is found in the Kubernetes API server. When a request is made to delete a namespace, the API server checks if the namespace is one of the system namespaces (such as default
, kube-system
, or kube-public
). If it is, the API server denies the request.
Hereβs an overview of where this logic is implemented: