5 . Obtain Service Account Token
Install OpenShift CLI
Before you can log into OpenShift cluster, first install OpenShift CLI on your machine.
For detail instructions on installing OpenShift CLI, please see Getting started with the OpenShift CLI.
Once OpenShift CLI is installed, then go to the next step to obtain Login Token
Obtain OpenShift Login Token
- Log into your OpenShift cluster account.
- Go to the upper right corner, click on the user drop down menu and select Copy login command.
- When asked to enter user credential, enter the user credential.
- Click Display Token.
- Copy the token under Log in with this token.
Obtain Service Account Token
Use the following CLI commands to obtain service account token on Openshift CLI.
- Open the CLI tool that has OpenShift CLI installed on your machine.
- Enter the user login token obtained earlier.
- List the service account info using your service account name and service account namespace (project name).
- Using the token name and service account namespace, generate a service account token.
- Copy the service account token.
oc describe sa <service account name> -n <service account namespace>
Obtain the token name from the Tokens parameter.
oc describe secrets <Tokens name> -n <service account namesapce>