Access the OpenShift Console and CLI
Login to the OpenShift Web Console
-
Set your account to the proper subscription.
az account set --subscription {azure_subscription} -
Make sure your cluster is ready by using the
aro showextension to theazcommand. Use this command to check on the state of your ARO clusters.az aro show \ --resource-group openenv-${GUID} \ --name aro-cluster-${GUID} \ --query "provisioningState" -o tsvSample OutputSucceeded -
First, let’s configure your workshop environment with some helper variables to store key values of our cluster to make accessing it easier. To do so, let’s run the following command:
cat << EOF >> ~/.workshoprc export OCP_PASS=$(az aro list-credentials --name \ aro-cluster-${GUID} --resource-group openenv-${GUID} \ --query="kubeadminPassword" -o tsv) export OCP_USER="kubeadmin" export OCP_CONSOLE="$(az aro show --name aro-cluster-${GUID} \ --resource-group openenv-${GUID} \ -o tsv --query consoleProfile)" export OCP_API="$(az aro show --name aro-cluster-${GUID} \ --resource-group openenv-${GUID} \ --query apiserverProfile.url -o tsv)" EOF source ~/.workshoprc echo "source ~/.workshoprc" >>~/.bashrc env | grep -E 'AZ_|OCP'Sample OutputOCP_USER=kubeadmin OCP_API={aro_public_api_url} OCP_PASS={aro_kube_password} OCP_CONSOLE={aro_console} -
To access the OpenShift CLI tools (
oc) and web console you will need to retrieve your cluster credentials. The helper variables from above will make this simple!To retrieve the credentials, run the following command:
az aro list-credentials --name aro-cluster-${GUID} --resource-group openenv-${GUID}Sample Output{ "kubeadminPassword": "{aro_kube_password}", "kubeadminUsername": "kubeadmin" } -
Next retrieve the console URL by running the following command:
az aro show --name aro-cluster-${GUID} --resource-group \ openenv-${GUID} -o tsv --query consoleProfileSample Output{aro_console} -
Finally, open the link to the console provided in a separate tab, and login with the provided credentials.
Login to the OpenShift CLI
Now that you’re logged into the cluster’s console, return to the lab command line console.
-
To login to the cluster using the OpenShift CLI tools (
oc), first we need to retrieve the API server endpoint. To do so, run the following command:az aro show -g openenv-${GUID} -n aro-cluster-${GUID} --query apiserverProfile.url -o tsvSample Output{aro_public_api_url} -
Now that we’ve captured the API server endpoint, we can login to the cluster by running the following command:
oc login "${OCP_API}" -u "${OCP_USER}" -p "${OCP_PASS}"Sample OutputLogin successful. You have access to 72 projects, the list has been suppressed. You can list all projects with 'oc projects' Using project "default".
Congratulations, you’re now logged into the cluster and ready to move on to the workshop content.