Kubectl - List only namespaces a user can access

8/8/2019

Looking if the below scenario is possible or not -

Lets say user(user1) have access only to namespaces default and marketing.

When we perform kubectl get ns it should display both namespaces.

No other namespaces should be displayed even if they exists because the user1 does not have access to any other namespaces.

We could relate this scenario with the databases where a user can see only the databases they have access to when show databases is performed

-- Avinash Reddy
kubectl
kubernetes
kubernetes-security

1 Answer

8/9/2019

This isn't possible in Kubernetes. Namespaces are the resources providing the scoping mechanism to limit visibility into other resources. There's no meta-namespace that provides scoping rules for namespaces.

-- Grant David Bachman
Source: StackOverflow