MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

Openshift: Lab 1 – Use the terminal window within the Red Hat OpenShift web console

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:

  1. Using your web browser, navigateย hereย (Figure 1, Callout 1).
  2. Selectย Start your sandbox for freeย (Figure 1, Callout 2).ย Figure 1: The entry point for access.
  3. 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.
OpenShift web console with terminal icon clicked, opening the command line terminal at the bottom

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.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Optum Lab 2 – Services – LoadBalancer

This lab shows how a Kubernetes Service gives a group of pods one stable address and spreads traffic across them, using the ClusterIP, NodePort and LoadBalancer types….

Read More

Troubleshooting Knative Guide

This page collects kubectl commands for troubleshooting Knative Serving: finding an OOMKilled activator, checking the net-istio-controller, load testing a Knative Service (ksvc), inspecting the autoscaler and its…

Read More

Kubectl: Persistent Volumes PV & PersistentVolumeClaim PVC

To turn an existing PersistentVolumeClaim (PVC) into a YAML manifest you can deploy again, run kubectl get pvc <name> -o yaml and remove the fields the cluster…

Read More

How to install Knative Servingย 1.7.4ย Manually?

To install Knative Serving 1.7.4 manually, you apply the Serving CRDs, then the core components, then a networking layer such as Istio or Kourier. Each step is…

Read More

How to Install and Configure Headlamp for Kubernetes on macOS, Linux and Windows

Managing Kubernetes is rarely difficult because of a shortage of tools. The challenge is knowing what is happening inside a cluster quickly enough to make the right…

Read More

How to Install and Configure K9s on macOS, Linux and Windows: Step-by-Step Guide

A complete hands-on Kubernetes management tutorial for DevOps Engineers, SREs, Platform Engineers and Kubernetes Administrators. K9s is a free, open-source, terminal-based Kubernetes management tool that simplifies the…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x