<p>I am using Kubernetes on Minikube.
I created a user context for a new user with role and rolebinding, using<br>
<code>kubectl config set-context user1-context --cluster=minikibe --namespace=default --user=user1</code><br>
When I try to see the runnig pods, target machine refuses it. But, in minikube context I can see the pods although both are running on the same cluster.</p>
<pre><code>&gt;kubectl config get-contexts
CURRENT   NAME             CLUSTER          AUTHINFO         NAMESPACE
          docker-desktop   docker-desktop   docker-desktop
          minikube         minikube         minikube
*         user1-context    minikibe         user1

&gt;kubectl get pods
Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.

&gt;kubectl config use-context minikube
Switched to context &quot;minikube&quot;.

&gt;kubectl get pods
NAME         READY   STATUS    RESTARTS   AGE
myapp-test   1/1     Running   0          44m
</code></pre>
<p>Config for rolebinding:</p>
<pre><code>apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: read-pods
subjects:
  - kind: User
    name: user1
    apiGroup: rbac.authorization.k8s.io
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: pod-reader
</code></pre>
<p>Role config</p>
<pre><code>apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: pod-reader
rules:
  - apiGroups: [&quot;&quot;]
    resources: [&quot;pods&quot;]
    verbs: [&quot;get&quot;,&quot;watch&quot;,&quot;list&quot;]
</code></pre>
<p>I also verified the creation of roles an rolesbinding</p>
<pre><code>&gt;kubectl get roles
NAME         CREATED AT
pod-reader   2020-10-20T05:59:43Z

&gt;kubectl get rolebindings
NAME        ROLE              AGE
read-pods   Role/pod-reader   65m
</code></pre>

Anwesh Budhathoki
<h2>Issue</h2>
<p>There was a typo in a <code>kubectl config set-context</code> command.</p>
<h2>Solution</h2>
<p>Use this command with <code>--cluster=minikibe</code> typo fixed.</p>
<pre><code>kubectl config set-context user1-context --cluster=minikube --namespace=default --user=user1
</code></pre>
