Log in to the an IBM Cloud Red Hat OpenShift cluster using the IBM Cloud and OpenShift CLI¶

This blog post is a small cheat sheet, how to log in to an IBM Cloud Red Hat OpenShift cluster using the IBM Cloud and the OpenShift CLI. I’am using information that is provided by the official IBM Cloud documentation.

  • Log in to the IBM Cloud
ibmcloud login [-sso]

  • Get the cluster configuration as admin
ibmcloud oc cluster config -c  my-redhat-openshift-cluster --admin

  • Get the master URL for the cluster
ibmcloud oc cluster get -c  my-redhat-openshift-cluster

Example output:

Retrieving cluster  my-redhat-openshift-cluster...
OK

Name:                        my-redhat-openshift-cluster
ID:                             c62jh5lf05XXXXXXX   
State:                          normal   
Status:                         All Workers Normal   
Created:                        2021-11-05 XX:XX:46 +0100 (1 week ago)   
Resource Group ID:              5d662c897a344XXXXXXX  
Resource Group Name:            Default   
Pod Subnet:                     172.17.0.0/18   
Service Subnet:                 172.21.0.0/16   
Workers:                        2   
Worker Zones:                   eu-de-1   
Ingress Subdomain:              my-redhat-openshift-cluster-d2f45-0000.eu-de.containers.appdomain.cloud   
Ingress Secret:                 my-redhat-openshift-cluster-4x32-d2f45-0000   
Ingress Status:                 healthy   
Ingress Message:                All Ingress components are healthy   
Public Service Endpoint URL:    https://XXXX.eu-de.containers.cloud.ibm.com:30XXX
Private Service Endpoint URL:   https:/XXXX.private.eu-de.containers.cloud.ibm.com:30XXX 
Pull Secrets:                   enabled in the default namespace   
VPCs:                           r010-d724a1ed-XXXXXX

Master         
Status:     Ready (1 week ago)   
State:      deployed   
Health:     normal   
Version:    4.8.14_1531_openshift   
Location:   Frankfurt   
URL:        https://XXXX.eu-de.containers.cloud.ibm.com:30XXX

  • Get an IBM Cloud passcode by opening following URL in a browser
https://iam.cloud.ibm.com/identity/passcode

  • Now log in to the cluster using the passcode and the master URL
oc login -u passcode -p GXIXXXXX --server=https://XXXXX.eu-de.containers.cloud.ibm.com:30XXX

Example output:

Login successful.

You have access to 66 projects, the list has been suppressed. You can list all projects with 'oc projects'

Using project "default".

I hope this was useful for you and let’s see what’s next?

Greetings,

Thomas

#ibmcloud, #openshift, #roks, #ibmcloudiam, #login

2 thoughts on “Log in to the an IBM Cloud Red Hat OpenShift cluster using the IBM Cloud and OpenShift CLI¶

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.