How to run oc command on cluster nodes in OpenShift 4.x

Solution Verified - Updated -

Issue

  • oc command fails when it is run from cluster nodes.
$ oc debug node/ip-x-x-x-x.ap-northeast-1.compute.internal     <<<------- Login to node
Starting pod/ip-x-x-x-xap-northeast-1computeinternal-debug ...
To use host binaries, run `chroot /host`
Pod IP: x.x.x.x
If you don't see a command prompt, try pressing enter.
sh-4.4# chroot /host
sh-4.4# oc get pod -n openshift-monitoring     <<<------- Run oc command
error: Missing or incomplete configuration info.  Please point to an existing, complete config file:     <<<-------- It fails!


  1. Via the command-line flag --kubeconfig
  2. Via the KUBECONFIG environment variable
  3. In your home directory as ~/.kube/config

To view or setup config directly use the 'config' command.
  • How to run oc command from cluster nodes, instead of bastion hosts, for debugging purpose?

Environment

  • Red Hat OpenShift Container Platform (RHOCP)
    • 4

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