5

I have a hard time trying to set up my (test) Kubernetes cluster so that it have a few users and a few namespaces, and a user can only see specific namespaces. Is there a way to do that? If yes, what is needed to

  1. Create a user
  2. Limit a user to a specific namespace or namespaces
  3. Use Kubernetes (via kubectl) as a specific user
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
user308993
  • 51
  • 1
  • 3

1 Answers1

5

You could setup ABAC (http://kubernetes.io/docs/admin/authorization/) and limit users to namespaces:

In the policy file you would have something like this if your user was bob and you wanted to limit him to the namespace projectCaribou:

{
  "apiVersion": "abac.authorization.kubernetes.io/v1beta1",
  "kind": "Policy",
  "spec": {
    "namespace": "projectCaribou",
    "readonly": true,
    "resource": "pods",
    "user": "bob"
  }
}
Gajus
  • 69,002
  • 70
  • 275
  • 438
Steve Sloka
  • 3,444
  • 2
  • 22
  • 29