Disable delete namespace - Kubernetes

9/27/2017

I created a namespace called qc for qc environment.

apiVersion: v1
kind: Namespace
metadata:
  name: {{ .Values.namespace.name | quote }}

kubectl create -f namespace.yaml

But I can delete this namespace anytime by running kubectl delete namespace qc.

How can I disable to delete user created namespaces?

Thank you

-- Gayan
kubectl
kubernetes
namespaces

1 Answer

9/27/2017

You do not want disable deletion of Namespaces for your kubernetes-admin user, although it could be possible. If there are other people or services interacting with your cluster, you need to define Users and/or Service Accounts for them and bind Cluster Roles to them, whitelisting their permissions. Have a look at Users in Kubernetes and Using RBAC Authorization in the official Kubernetes Documentation.

-- Simon Tesar
Source: StackOverflow