Skip to content

Finding your way around a cluster

When you first land on an OpenShift cluster — yours or someone else’s — you need four things fast: the console URL, the API endpoint, the admin credentials, and the cluster’s real name. Here’s how to get each without clicking around.

Watch on YouTube ↗
Terminal window
# Web console
oc whoami --show-console
# https://console-openshift-console.apps.my-cluster.example.com
# API server
oc whoami --show-server
# https://api.my-cluster.example.com:6443

--show-console is the one people forget exists and instead go hunting through the web UI for. It reads the console route directly.

Terminal window
oc whoami # current username
oc whoami -t # current session token
oc auth can-i create pods # does my account have a given permission?

The name you typed at install time isn’t quite the cluster’s canonical identity — OpenShift derives an infrastructure name (with a random suffix) that tags cloud resources and appears in machine names:

Terminal window
oc get infrastructure cluster -o jsonpath='{.status.infrastructureName}'
# my-cluster-x7k2p

Where this lives depends on how the cluster was created:

The installer writes it once to the install directory:

Terminal window
cat <install-dir>/auth/kubeadmin-password
Terminal window
oc get clusterversion # version + whether an update is progressing
oc get co # cluster operators — all should be Available
oc get nodes # every node should be Ready

If oc get co shows anything Degraded or Progressing for a long time, that’s usually where a cluster problem is hiding — start there.