oc command gives unauthorized authentication errors in OpenShift

Solution Unverified - Updated -

Issue

  • While using the oc(OpenShiftClient) commands in OpenShift, like oc get nodes , oc get pods, oc get events, the following error is highlighted:
You must be logged in to the server (the server has asked for the client to provide credentials)

Environment

  • OpenShift Container Platform (OCP)
    • 3.2+

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content