OpenShift Quick Start: CLI

David Pitt Articles, Microservices, OpenShift, openshiftseries Leave a Comment

Attention: The following article was published over 7 years ago, and the information provided may be aged or outdated. Please keep that in mind as you read the post.

This post is a continuation of our hands-on OpenShift Quick Start blog series. In the first post we introduced OpenShift, and in part two, you worked to get OpenShift running locally & adding a Container with an API service to a Pod. Make sure you’ve completed that step prior to starting the continued exercise below!

The previous blogs in this series managed OpenShift using the web admin user interface. However, everything that can be done with the user interface can also be done from using the CLI (Command Line Interface). Arguably, developers prefer to interact with text commands, but that’s a generalization.

In this post, we’ll demonstrate common OpenShift commands can be done in the web admin from the command line.

Here are the reasons the CLI might be used over the command line interface.

  • Integrating with programming languages
  • Scripting
  • When bandwidth is constrained
Related Posts:  Navi: A “Cheatsheet” CLI

The CLI is used to start up the cluster, which you should have completed in the previous blog as shown below.

oc cluster up

Available CLI commands are displayed using the help option:

oc help 

Available help commands will be displayed:

You can obtain the status of your cluster:

oc cluster up 

Other Example Commands

Here are a couple more example commands.

Cluster projects
$ oc project
Deploy container image to a Pod
     $ oc deploy example-api -n myproject
Scaling up a Pod to 3 replicas
    $ oc scale --replicas dc example-api

There are many commands. Essentially, you can do everything you can do in the web admin from the command line.

The next blog in this OpenShift series will walk through the Continuous Integration / Continuous Delivery (CICD) building and Jenkins 2 Pipeline integration. Stay tuned!

Series

  1. Introduction to Managing Docker Containers with OpenShift and Kubernetes
  2. OpenShift Quick Start – Installing OpenShift locally & adding a Container with an API service to a Pod
  3. This Post –> Scaling Pods and Managing Cluster with the Command Line Interface
  4. Continuous Build and Deploy with Jenkins 2 Pipelines
  5. Using a STI (Source to Image) Utility to Create and Deploy Spring Boot Java Image
Related Posts:  Simplifying IAP Setup on GCP with Terraform

Related Posts

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments