This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.第 11 章 Logging in to the cluster
You can log in to your cluster as a default system user by exporting the cluster kubeconfig
file. The kubeconfig
file contains information about the cluster that is used by the CLI to connect a client to the correct cluster and API server. The file is specific to a cluster and is created during OpenShift Container Platform installation.
Prerequisites
- Deploy an OpenShift Container Platform cluster.
-
Install the
oc
CLI.
Procedure
Export the
kubeadmin
credentials:export KUBECONFIG=<installation_directory>/auth/kubeconfig
$ export KUBECONFIG=<installation_directory>/auth/kubeconfig
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- For
<installation_directory>
, specify the path to the directory that you stored the installation files in.
Verify you can run
oc
commands successfully using the exported configuration:oc whoami
$ oc whoami
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
system:admin
system:admin
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
11.1. Verifying cluster status 复制链接链接已复制到粘贴板!
You can verify your OpenShift Container Platform cluster’s status during or after installation.
Procedure
In the cluster environment, export the administrator’s kubeconfig file:
export KUBECONFIG=<installation_directory>/auth/kubeconfig
$ export KUBECONFIG=<installation_directory>/auth/kubeconfig
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- For
<installation_directory>
, specify the path to the directory that you stored the installation files in.
The
kubeconfig
file contains information about the cluster that is used by the CLI to connect a client to the correct cluster and API server.View the control plane and compute machines created after a deployment:
oc get nodes
$ oc get nodes
Copy to Clipboard Copied! Toggle word wrap Toggle overflow View your cluster’s version:
oc get clusterversion
$ oc get clusterversion
Copy to Clipboard Copied! Toggle word wrap Toggle overflow View your Operators' status:
oc get clusteroperator
$ oc get clusteroperator
Copy to Clipboard Copied! Toggle word wrap Toggle overflow View all running pods in the cluster:
oc get pods -A
$ oc get pods -A
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Troubleshooting
If the installation fails, the installation program times out and displays an error message. To learn more, see Troubleshooting installation issues.