Explore OpenShift

The Web Console

OpenShift ships with a web-based console that will allow users to perform various tasks via a browser.

  • ROKS

  • ROSA

  • ARO

  • Sandbox

  • Others

Login to IBM Cloud, copy this link and open in your browser:

%LOGIN%

Enter following credentials:

Username:

%USERNAME%

Password:

%PASSWORD%

Click Sign In.

ROKS Login

After you successfully logged in, from right side pane, click OpenShift web console to access your OpenShift Cluster Dashboard:

ROKS Open-shift web console

Access your cluster from OpenShift Web Console.

Login to your ROSA cluster using one of the available Identity Provider.

ROSA Login

On the Identity Provider login screen, enter the your credentials:

Username:

%USERNAME%

Password:

%PASSWORD%

Access your cluster from OpenShift Web Console.

Cluster administrator

If you are the administrator of your ARO cluster (kubeadmin), you can login with your credentials if you already have them.

If don’t have them yet, as an admin for the cluster in Azure Portal, you can also retrieve credentials with the az CLI.

export RESOURCEGROUP=<Resource_group_name>
export CLUSTER=<Cluster_name>

az aro list-credentials \
  --name $CLUSTER \
  --resource-group $RESOURCEGROUP

You should get something similar with the following output containing your cluster admin credentials:

{
  "kubeadminPassword": "<generated password>",
  "kubeadminUsername": "kubeadmin"
}

If available, you can also login to your ARO cluster using one of the Identity Providers such as Azure Active Directory.

Azure Active Directory

If you configured Azure Active Directory (AAD), select this identity provider to login using Azure authentication.

ARO Login

Enter the your credentials:

Username:

%USERNAME%

Password:

%PASSWORD%

Developer Sandbox for Red Hat OpenShift is a free Kubernetes cloud environment in a shared, multi-tenant OpenShift cluster that is pre-configured with a set of developer tools. The Developer Sandbox is active for 30 days and renewable once it expires.

To create your account, register to Developer Sandbox for Red Hat OpenShift. From there, click on the red button that says Get Started in the Sandbox as shown in the following image.

Developer Sandbox Sign-up Page

Use your existing Red Hat account or create a new one, then follow the instructions on the screen. You should then be redirected to the Developer Sandbox page again, but this time, you should see a button labelled Start using your sandbox.

Developer Sandbox Start Page

Clicking on it opens up the OpenShift login screen where you can log in using the DevSandbox button, as seen below.

Log in the Developer Sandbox

Clicking this button opens up your new OpenShift cluster console.

Topology View
Quotas and Limits

Your private OpenShift environment on Developer Sandbox includes quotas and limits of:

  • 7 GB RAM

  • 15GB storage

which is enough to run this workshop.

There are two fixed projects (namespaces):

  • <your_username>-dev

  • <your_username>-stage

In this shared environment, it’s NOT possible to create a new project as in Create your First Project. This environment doesn’t support Pipelines Operator, so you can skip the OpenShift Pipelines prerequisite.

Please work in the <your_username>-dev project.

To continue working with the Lab, please do the following:

1 - Copy your cluster subdomain as shown in the image above, part 1 e.g. apps.sandbox-m2.ll9k.p1.openshiftapps.com. This is used to generate automatically all URLs during the workshop.

Topology Detail

Go to the top menu of this Lab guide, and paste the copied hostname into the first textfield, where there is Enter Cluster Subdomain.

Add Cluster Subdomain

Press Enter to Submit.

2 - Copy the project name of your Developer Sandbox as shown in the image above, part 2 e.g. user-dev. This is also used to generate automatically all URLs and instructions during the workshop.

Add Project Name

Go to the top menu of this Lab guide, and paste the copied project name into the second textfield, where there is Enter Project Name.

Press Enter to Submit.

Your Lab Guide is now customized with your Developer Sandbox environment hostname and settings:

Lab Guide OK

To get a feel for how the web console works, click on this Web Console link.

On the login screen, enter the following credentials:

Username:

%USERNAME%

Password:

%PASSWORD%

In general, the first time you access the web console, you will most likely be in the Administrator perspective. In case you are also the Cluster Administrator, you will be presented with an overview of the whole Cluster status:

Web Console Overview

Command Line Interface

OpenShift ships with a feature rich web console as well as command line tools to provide users with a nice interface to work with applications deployed to the platform. The OpenShift tools are a single executable written in the Go programming language and is available for the following operating systems:

  • Microsoft Windows

  • Mac OS X

  • Linux

You might already have the OpenShift CLI available on your environment. You can verify it by running an oc command:

oc version

You should see the following (or something similar):

Client Version: 4.9.2
Server Version: 4.9.15 (1)
Kubernetes Version: v1.22.3+e790d7f
1 NOTE: you will only see the Server Version and Kubernetes Version if you are currently connected to a Kubenetes or OpenShift cluster

If you see output like the above you can skip to Connect to the OpenShift Cluster from CLI.

However, if the oc command doesn’t exist or you have an older version of the OpenShift CLI (e.g. < 4.4.x), select the tab appropriate to your OS and follow the instructions to install or update the OpenShift CLI.

Download OpenShift CLI

  • Mac OSX

  • Windows

  • Linux

If you have HomeBrew installed you can instead install the OpenShift CLI using the brew command. If you don’t have homebrew, then follow the manual download and install instructions that follow the inset.
Download and Install OpenShift CLI on Mac OS X using HomeBrew
brew install openshift-cli

You may also want to enable CLI autocompletion (bash or zsh):

source <(oc completion bash)
source <(oc completion zsh)

To make CLI autocompletion persistent (bash or zsh) by adding a relevant line to your .bashrc or .zshrc:

oc completion bash > oc_bash_completion.sh

source oc_bash_completion.sh
oc completion zsh > oc_zsh_completion.sh

source oc_zsh_completion.sh

From top right menu bar, click to the little white question mark icon, then click to Command Line Tools:

Download CLI

Scroll down to oc - OpenShift Command Line Interface (CLI) and click on the link appropriate to your OS

CLI Binaries

Once the file has been downloaded, you will need to extract the contents as it is a compressed archive. It is recommended that this file is saved to the following directory:

~/OpenShift

Open up a terminal window and change to the directory where you downloaded the file. Once you are in the directory, enter in the following command:

The name of the oc packaged archive may vary. Adjust accordingly.
tar zxvf oc-macosx.tar.gz

The tar.gz file name needs to be replaced by the entire name that was downloaded in the previous step.

Now you can add the OpenShift CLI tools to your PATH.

export PATH=$PATH:~/OpenShift

At this point, we should have the oc tool available for use. Let’s test this out by printing the version of the oc command:

oc version

You should see the following (or something similar):

Client Version: 4.7.0

If you get an error message, you may not have not updated your path correctly. If after checking your PATH you still cannot get the oc command to work, contact your lab instructor for assistence.

From top right menu bar, click to the little white question mark icon, then click to Command Line Tools:

Download CLI

Scroll down to oc - OpenShift Command Line Interface (CLI) and click on the link appropriate to your OS

CLI Binaries

The CLI for Windows is provided as a zip archive. Download and unzip the archive with a ZIP program and move the oc binary to a directory on your PATH. To check your PATH, open the Command Prompt and run:

path

Checkout this blog post if you’d like to set it up with Powershell

At this point, we should have the oc tool available for use. Let’s test this out by printing the version of the oc command:

oc version

You should see the following (or something similar):

Client Version: 4.7.0

If you get an error message, you may not have not updated your path correctly. If after checking your PATH you still cannot get the oc command to work, contact your lab instructor for assistence.

From top right menu bar, click to the little white question mark icon, then click to Command Line Tools:

Download CLI

Scroll down to oc - OpenShift Command Line Interface (CLI) and click on the link appropriate to your OS

CLI Binaries

Once the file has been downloaded, you will need to extract the contents as it is a compressed archive. It is recommended that this file is saved to the following directory:

~/OpenShift

Open up a terminal window and change to the directory where you downloaded the file. Once you are in the directory, enter in the following command:

The name of the oc packaged archive may vary. Adjust accordingly.
tar zxvf oc-linux.tar.gz

The tar.gz file name needs to be replaced by the entire name that was downloaded in the previous step.

Now you can add the OpenShift CLI tools to your PATH.

export PATH=$PATH:~/OpenShift

At this point, we should have the oc tool available for use. Let’s test this out by printing the version of the oc command:

oc version

You should see the following (or something similar):

Client Version: 4.7.0

If you get an error message, you may not have not updated your path correctly. If after checking your PATH you still cannot get the oc command to work, contact your lab instructor for assistence.

Web Terminal

OpenShift Web Console supports a web based Terminal called Web Terminal. Instead of installing the oc CLI locally, you could just run this web based terminal containing useful tools such as:

  • oc

  • kubectl

  • odo

  • helm

  • tkn

  • kn

If you want to have it in your current cluster, you can install it from OperatorHub following the documentation.

If you are using Developer Sandbox for OpenShift, this has been already installed to your cluster!

Navigate to top-right, click the command line terminal icon.

Web Terminal

From bottom-left, click the Start button.

Start Web Terminal

Start using oc from the web terminal. The session is usually already authenticated to the cluster so you can skip the following section on how to connect from CLI.

Use Web Terminal
oc whoami

Connect to the OpenShift Cluster from CLI

Once your oc client is setup on your Workstation, you can connect to cluster and start working also with OpenShift CLI.

From Web Console overview, go to top-right menu bar and click to the dropdown menu containing your username, then click Copy Login Command:

Copy Login Command

Click on Display Token and copy the command under Login with this token:

Example:

oc login --token=some_token --server=https://c104-e.us-east.containers.cloud.ibm.com:32208
Logged into "https://c104-e.us-east.containers.cloud.ibm.com:32208" as "%USERNAME%" using the token provided.

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

Using project "default".

Working with proxies

It might happen that you’re behind a corporate proxy to access the internet. In this case, you’ll need to set some additional environment variables for the oc command line to work. Select the tab appropriate to your OS below.

  • Mac OS X

  • Windows

  • Linux

Replace the proxy server with the one for your environment/machine.
export https_proxy=http://proxy-server.mycorp.com:3128/
export HTTPS_PROXY=http://proxy-server.mycorp.com:3128/

Follow previous section’s instructions on how to set an Environment Variable on Windows. The variables you’ll need to set are:

Replace the proxy server with the one for your environment/machine.
https_proxy=http://proxy-server.mycorp.com:3128/
HTTPS_PROXY=http://proxy-server.mycorp.com:3128/
Replace the proxy server with the one for your environment/machine.
export https_proxy=http://proxy-server.mycorp.com:3128/
export HTTPS_PROXY=http://proxy-server.mycorp.com:3128/

If the proxy is secured, make sure to use the following URL pattern, replacing the contents with the appropriate values:

export https_proxy=http://USERNAME:PASSOWRD@proxy-server.mycorp.com:3128/

Special Characters: If your password contains special characters, you must replace them with ASCII codes, for example the at sign @ must be replaced by the %40 code, e.g. p@ssword = p%40ssword.