In this lesson, you will learn how to access the terminal window within the Red Hat OpenShift web console and use it to work with various OpenShift and Kubernetes resources that are available in the OpenShift cluster to which the web console is bound.
What you need to know
In order to get full benefit from taking this lesson, you need to:
- Have a basic understanding of the nature and use of Kubernetes as aย containerย orchestration framework.
- Understand the relationship between OpenShift and Kubernetes.
- Have aย basic understanding of the nature and purpose of theย
kubectlย CLI tool. - Know how to access your dedicated instance of theย Developer Sandbox.
What you will learn
In this lesson you will learn:
- How to access the terminal window thatโs embedded within the OpenShift web console.
- How to use theย
kubectlย andยocย CLI tools to interact with the various Kubernetes resources within the OpenShift cluster.
Access the terminal window
To reach the OpenShift terminal window within your no-cost Developer Sandbox cluster, complete the following steps:
- Using your web browser, navigateย hereย (Figure 1, Callout 1).
- Selectย Start your sandbox for freeย (Figure 1, Callout 2).ย Figure 1: The entry point for access.
- Once you’re in the OpenShift web console, click theย terminal promptย icon in the upper right corner of the web page (Figure 2, Callout 1) to display the command-line terminal (Figure 2, Callout 2).ย You can use the terminal window to interact directly with the underlying Kubernetes cluster powering the OpenShift instance.ย Figure 2: The OpenShift web console can display a terminal window that enables direct interaction with the underlying Kubernetes cluster in the OpenShift instance.

Work with the oc and kubectl CLI tools from within the terminal window
The terminal window thatโs embedded within the OpenShift web console is a full blown instance of aย Linuxย terminal. There, you can do the same command-line activities you would normally run in a standalone terminal. Also, the OpenShift web console terminal window allows you to work easily with the OpenShift instance and its underlying Kubernetes cluster.
OpenShift has both theย ocย andย kubectlย CLI tools pre-installed and configured to access the underlying Kubernetes cluster within the OpenShift instance. Thus, you can interact with OpenShift and the underlying Kubernetes from the command line.
Theย ocย CLI tool has much of the same functionality thatย kubectlย provides. However,ย ocย can go a bit further and allow you to execute behavior that is special to OpenShift. For example, you can useย ocย to install an application into OpenShift without having to negotiate the complexities of application deployment in Kubernetes.
The following exercises demonstrate how to use theย ocย andย kubectlย CLI tools to execute basic tasks from the terminal windowโs command line. The exercises also demonstrate the close relationship between OpenShift and Kubernetes.
Get version information
Run the following command in the OpenShift terminal to get version information aboutย ocย CLI tool:
oc version
You will see output similar to the following:
Client Version: 4.10.6
Server Version: 4.10.28
Kubernetes Version: v1.23.5+012e945Code language: CSS (css)
The results of theย ocย versionย command display the version numbers of theย ocย CLI client, the server powering the current OpenShift instance and as well as the version number of the underlying instance of Kubernetes used by the cluster.
View resources using oc or kubectl
Run the following command in the OpenShift terminal to get a list of pods running in the current instance of OpenShift using theย ocย CLI tool:ย
oc get podsCode language: JavaScript (javascript)
You will receive output similar to the following:
NAME READY STATUS RESTARTS AGE
workspace1e8db31dd59c43ef-8585ff4cc-24ww6 2/2 Running 0 22s
Run the following command in the OpenShift terminal to get a list of pods running in the current instance of OpenShift using theย kubectlย CLI tool:ย
kubectl get podsCode language: JavaScript (javascript)
You will receive output similar to the following:
NAME READY STATUS RESTARTS AGE
workspace1e8db31dd59c43ef-8585ff4cc-24ww6 2/2 Running 0 22s
Notice that the output from executingย oc get podsย andย kubectl get podsย is identical. This is because bothย ocย andย kubectlย are querying the same underlying Kubernetes cluster to get a list of pods. This is direct evidence of the tight relationship between OpenShift and Kubernetes.ย
Remember, OpenShift is a layer of components that โsit on topโ of an underlying Kubernetes cluster. The important thing to understand is that theย ocย CLI tool provides functionality available in theย kubectlย CLI tool. In many cases, you can useย ocย andย kubectlย interchangeably.
Summary
In this lesson, you learned how to access the terminal window embedded in the OpenShift web console. Also, you learned how to use the terminal window to execute commands using theย ocย andย kubectlย CLI tools. You executed bothย oc get podsย andย kubectl get podsย to list the same set of pods running in the Kubernetes cluster thatโs foundational to OpenShift.
Iโm a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at Cotocus. I share tech blog at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow , and SEO strategies at Wizbrand.
Do you want to learn Quantum Computing?
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at WIZBRAND
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services โ all in one place.
Explore Hospitals