kubectl - error: You must be logged in to the server
Asked Answered
C

2

3

I have configured OIDC with k8s installed using kubeadm. After the configuration, when I run the command kubectl [email protected] 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?

Creighton answered 7/8, 2017 at 5:48 Comment(0)
C
2

I use kubectl [email protected] get nodes and it works. Earlier I was using the parameter --user instead of --username.

Creighton answered 10/8, 2017 at 8:52 Comment(1)
--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.Alexaalexander
H
0

Your password is probably missing.

Hanako answered 7/8, 2017 at 5:51 Comment(4)
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 helpfulCreighton
Sorry, I'm not an expert with kub, (but in openshift you should log with user, passwd) but --password="": might help. Please refer to: kubernetes-v1-4.github.io/docs/user-guide/kubectl/…Hanako
Cloud you please tell me if i can add a role with the user and the password with K8S?Creighton
Should the user be explicitly registered for this? I meant to ask if kubectl config set-context and set-credentials is required for this.Creighton

© 2022 - 2024 — McMap. All rights reserved.