manage
login-to-ocp
Log in to OpenShift®
Container Platform from the current cpd-cli session. This command uses the same arguments as the oc
login command.
Extended description
Important: To run this command, you must have the Red Hat® OpenShift command-line interface (
oc
CLI) on your local workstation.The login-to-ocp
command is a prerequisite for any
cpd-cli
manage
commands that issue commands to your Red Hat OpenShift Container Platform cluster.
The login-to-ocp
command sends the information that you
provide to the oc
CLI, which logs you in to your Red Hat OpenShift Container Platform cluster.
Syntax
The login-to-ocp
command takes the same input as the
oc login
command. Run oc login --help
for details.
cpd-cli manage login-to-ocp \
<openshift-login-arguments>
Examples
Note: The following example uses the recommended installation environment variables.
Use a script to create environment variables with the correct values for your environment. For details, see Best practice: Setting up install variables.
- Log in to the cluster by providing a username and password
-
cpd-cli manage login-to-ocp \ --username=${OCP_USERNAME} \ --password=${OCP_PASSWORD} \ --server=${OCP_URL}
- Log in by providing a token.
-
cpd-cli manage login-to-ocp \ --server=${OCP_URL} \ --token=${OCP_TOKEN}