<p>I have configured keycloak for Kubernetes RBAC. </p>

<ul>
<li>user having access to get pods</li>
</ul>

<pre><code>vagrant@haproxy:~/.kube$ kubectl auth can-i get pods --user=oidc
Warning: the server doesn't have a resource type 'pods'
yes
</code></pre>

<pre><code>vagrant@haproxy:~/.kube$ kubectl get pods --user=oidc
error: You must be logged in to the server (Unauthorized)
</code></pre>

<p>my kubeconfig file for the user looks like below</p>

<pre class="lang-yaml prettyprint-override"><code>users:
- name: oidc
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1beta1
      args:
      - oidc-login
      - get-token
      - --oidc-issuer-url=https://test.example.com/auth/realms/kubernetes
      - --oidc-client-id=kubernetes
      - --oidc-client-secret=e479f74d-d9fd-415b-b1db-fd7946d3ad90
      - --username=test
      - --grant-type=authcode-keyboard
      command: kubectl
</code></pre>

<p>Is there anyway to get this to work?</p>

<p>The issue was with the ip address of the cluster. You might have to configure the DNS name if the ip address. </p>
