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 of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.