2

I have configured OIDC with k8s installed using kubeadm. After the configuration, when I run the command kubectl --user=name@gmail.com get nodes I get

error: You must be logged in to the server (the server has asked for the client to provide credentials (get nodes))

Can someone please help me with this?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
NSP
  • 1,193
  • 4
  • 15
  • 26

2 Answers2

1

I use kubectl --username=name@gmail.com get nodes and it works. Earlier I was using the parameter --user instead of --username.

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
NSP
  • 1,193
  • 4
  • 15
  • 26
  • 2
    --user is the correct parameter. --username is ignored, which means you may have been falling back to a default user that does not use oidc. – Phyxx Dec 09 '18 at 21:01
0

Your password is probably missing.

Totoc1001
  • 338
  • 2
  • 11
  • I have added the client_id, client_secret, id_token and refresh token to my /.kube/config file. Where do i need to add my password? Could you please let me know. It would be really helpful – NSP Aug 07 '17 at 06:11
  • Sorry, I'm not an expert with kub, (but in openshift you should log with user, passwd) but `--password="":` might help. Please refer to: https://kubernetes-v1-4.github.io/docs/user-guide/kubectl/kubectl_config_set-credentials/ – Totoc1001 Aug 07 '17 at 06:33
  • Cloud you please tell me if i can add a role with the user and the password with K8S? – NSP Aug 07 '17 at 08:10
  • Should the user be explicitly registered for this? I meant to ask if kubectl config set-context and set-credentials is required for this. – NSP Aug 07 '17 at 08:41