Unable to use-context from kubeconfig file Unable to use-context from kubeconfig file kubernetes kubernetes

Unable to use-context from kubeconfig file


It's unlikely that OpenShift Kubernetes allows authentication using username and password. The oc login command internally authenticate using username and password to a oAuth server to get a bearer token which automatically is stored in the kubeconfig file used by kubectl. When you do any kubectl command that token is used to authenticate with the Kubernetes cluster.

You can check the token via oc config view. You can get the token and set it with kubectl config set-credentials kubeadmin --token=bearertoken and it should work.

Refer the docs here.

Alternatively you can follow this doc here to get a bearer token.