Unable to login Openshift Cluster

2k Views Asked by At

After the upgrading kubectl, I am unable to login on Openshift cluster.

When i am trying to login with oc login command it is reverting the below error message:

Error: unknown command "login" for "kubectl"

 Did you mean this?

 logs
 plugin

 Run 'kubectl --help' for usage.

Below are the some details of version from machine where i have the login issue

# kubectl version

 Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.0", GitCommit:"9e991415386e4cf155a24b1da15becaa390438d8", GitTreeState:"clean", BuildDate:"2020-03-25T14:58:59Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}

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

Below are the some details of version from machine where i have no issue , i am able to login and didn't upgrade kubectl version

# kubectl version

 Client Version: version.Info{Major:"", Minor:"", GitVersion:"v0.0.0-master+$Format:%h$", GitCommit:"$Format:%H$", GitTreeState:"", BuildDate:"1970-01-01T00:00:00Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"}

 Server Version: version.Info{Major:"1", Minor:"16+", GitVersion:"v1.16.2+f2384e2", GitCommit:"f2384e2", GitTreeState:"clean", BuildDate:"2020-06-16T03:21:27Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"}

Addition: I have checked by downgrade the kubectl versions , but getting same error on that machine where i unable to login using oc login.

1

There are 1 best solutions below

0
Simon On

It looks like you have symlinked oc to kubectl somehow.

As you note, kubectl does not have a login method, you need to actually use the oc CLI tool to log into your OpenShift cluster. This will get the proper tokens that you need to talk to the OpenShift API.

Alternatively, you can get the necessary token via the OpenShift Web Console (top right, "Copy Login Command" or something like that).