OpenShift 101: Web console and CLI
Learn about the capabilities of the Developer and Administrator perspectives
In the first blog post in this introductory series on RedHat OpenShift, you learned about its architecture and components. In this blog post, you will explore the OpenShift web console and command-line interface (CLI) and learn about the capabilities of the Developer and Administrator perspectives on the platform.
The new web console UI is one of the major improvements in OpenShift 4. If you used OpenShift 3, you will notice this improvement. When you first log in to the cluster, the navigation list is on the left. If you click on Administrator, that’s where you can switch the view to Developer, and you will notice how different the listed tabs are.
There are mainly two perspectives on the web console: Administrator and Developer. You can have different accounts with different permissions that are managed by the Administrator using cluster role binding or project role binding. For now, I will stick to introducing the roles of Administrator and Developer on the web console.
I think it is a good idea to start with explaining the Developer perspective as it is more likely to relate to the capabilities of this role. The Developer perspective provides specific workflows related to the developer use case, like:
Creating and deploying applications by importing existing codebases, images, and dockerfiles
Visually interacting with applications and components within a project and monitoring their deployment and build status
Grouping components within an application and across applications
Integrating serverless capabilities
If you take a look at the top of the platform, you can pick your project or create a new one, and you can also view the applications inside each project. In the navigation menu, you see the following tabs:
Topology: View the applications in your project. If you don’t have any applications, this page shows you a catalog with options that you can use to add your content. You can also find the catalog in the +Add tab to add any new applications.
Builds: View and create builds that you can create as YAML or JSON definitions; where you define a build configuration that describes a single build definition and a set of triggers for when a new build should be created.
Pipelines: Work with the pipelines in your project. As long as the pipelines operator is installed in the project by the Administrator, you can view and deploy the pipelines.
Advanced: View project details, status, activity, and utilization; manage user access to the project; view metrics; search for components in the project; and stream events related to the project.
The Administrator perspective in the OpenShift cluster is responsible for managing the cluster resources, users, and projects. In this navigation menu, you see the following tabs:
Home: See an overview dashboard of the cluster that summarizes the cluster status, alerts, breakdown of the cluster capacity by CPU, memory storage, and network utilization, some details about cluster and cluster inventory, and top consumers by category.
Operators: Explore operators and install them for your cluster and projects from the OperatorHub and navigate through installed Operators.
Workloads, Networking, and Storage: View and manage resources like deployment, secrets, and the pods in your project.
Networking: View and manage the services and routes of your applications.
Storage: View and manage the persistent volumes in your project.
Builds: Manage build configurations, builds, and image streams.
Pipelines: View your pipelines, tasks, and resources related to the cluster and projects, where you can view their status and access them for more details.
Monitoring: View alerts and perform ad hoc Prometheus queries.
Compute: View and manage compute resources like nodes, machines, and autoscalers.
User Management: View a list of users, create users and groups, and manage roles in the cluster and projects.
Administration: View settings related to cluster administration, like details about the cluster, namespaces, cluster updates, quotas, and Custom Resource Definitions (CRDs).
Now, let’s look at the OpenShift CLI (
oc) and some of the most common commands that you might use in your future projects. With the CLI, you can do so much with your cluster and projects whether you are an Administrator or a Developer. Many of the things you can do on the web console you can also do with the CLI. Managing clusters and projects is easy and simple with the CLI. Keep in mind that the version of the CLI on your machine should match the version of your cluster.
Installing the CLI
One of the ways to install the command line on your machine with the correct version is using the
oc -n openshift-console get routes command, which shows you the route to the downloads where you can install the command line that’s relevant to your operating system. This can help make sure you have the same version of OpenShift in both your cluster and CLI on your machine.
You can also access the link from the web console in the project
openshift-console and then click on the downloads application route.
The route leads you to a directory that looks like the following:
Directory listing for /
You can then download the command line and add it as environment variable on your machine.
You can run the
oc help command to view any information that you would like to learn about the
- To log in or log out of the cluster, use the
- To create a new application from the CLI, run
oc new-app <link-to-repository>.
- To view list of projects in your cluster, use
oc get projects.
- If you want to pick a specific project, use the command
oc project <project-name>.
For external users to be able to access your applications, you first need to create a route to the service that you want using the command
oc expose service <app-name> --hostname=www.example.com. The hostname parameter is optional if you want to customize the domain name.
oc get routes command to get the list of routes in your project, copy the route under the title WILDCARD, and paste it to your browser to access your application.
By now, you probably have noticed that the commands follow the syntax
oc <action> <object_type> <object_name_or_id>. This is because the CLI allows interaction with various objects that are managed by OpenShift, where action can be something like
describe; object type like
service (svc), or
object name/ID of the specified object type. Of course, it is not limited to these object types and actions, and there are many more commands that you can try.
I have only introduced the basic and most common commands in OpenShift here. If you are interested in learning more about
oc commands, I highly recommend the OpenShift documentation and exploring hands-on at developer.ibm. Join me in the next blog post in the series where I will dive a little deeper and talk about one of the operators in OpenShift: OpenShift Pipelines.