<p>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</p>

<ol>
<li>Create a user</li>
<li>Limit a user to a specific namespace or namespaces</li>
<li>Use Kubernetes (via kubectl) as a specific user</li>
</ol>

<p>You could setup ABAC (<a href="http://kubernetes.io/docs/admin/authorization/" rel="nofollow noreferrer">http://kubernetes.io/docs/admin/authorization/</a>) and limit users to namespaces:</p>

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

<pre><code>{
  "apiVersion": "abac.authorization.kubernetes.io/v1beta1",
  "kind": "Policy",
  "spec": {
    "namespace": "projectCaribou",
    "readonly": true,
    "resource": "pods",
    "user": "bob"
  }
}
</code></pre>
