Skip to main content
Hello, and welcome to this lesson. In this lesson we’ll explore the OpenShift web console and the oc CLI. You’ll learn how to use the console Catalog to deploy applications (for example, a Python app) and how to use the oc command-line tool bundled with Minishift to inspect and interact with a local OpenShift cluster. The OpenShift web console provides a catalog of pre-configured builder images and templates that make application deployment straightforward. To deploy a Python application, select the Python catalog item and follow the deployment wizard—enter the application repository or source, choose resource limits and environment variables, and finish the deployment.
A screenshot of the OpenShift Origin web console showing a modal for the Python builder image, with the Python logo, a brief description about building Python 3.6 on CentOS 7, and a three-step progress bar. Other builder images are visible blurred in the background and the modal shows Cancel and Next buttons.
You can deploy many other services the same way—databases, CI/CD tools, message brokers, etc. Creating custom catalog items and templates is a more advanced topic and is outside the scope of this lesson.

Projects and the Add to Project workflow

On the console’s right-hand side you will see a list of Projects. By default, OpenShift creates a project named “My Project” (myproject) for the logged-in developer user. Use the “Create Project” button to add additional, named projects. Clicking a project opens the Project Overview, which shows:
  • Applications and their current status
  • BuildConfigs and DeploymentConfigs (build and deploy workflows)
  • Routes and Services for network exposure
  • Persistent storage and monitoring information
Use the “Add to Project” button (top-right) to add applications or resources to the selected project—this launches the same catalog-based deployment flow shown above.

Getting the oc CLI

The oc command-line tool is the primary CLI for interacting with OpenShift from your terminal. If you’re using Minishift, it includes a compatible oc client. If you are not using Minishift, you can download the OpenShift CLI from the web console Help menu:
  • In the web console, open the Help menu (top-right) and choose Command Line Tools to find oc downloads and instructions.
A screenshot of a GitHub Releases page for OpenShift Origin v3.9.0 showing the release title and a list of downloadable assets (client/server tarballs and source zip files).
Minishift caches the oc binary locally and also prints the commands needed to configure your shell to use it. The following sections show a typical Windows CMD workflow when using Minishift.

Using the oc client bundled with Minishift

When Minishift starts it prints essential information including the web console URL and how to log in. Example (trimmed) Minishift start output:
If oc is not on your PATH, attempting to run oc from a shell that doesn’t have it configured will produce an error like this on Windows:
To add the oc binary to your PATH, run minishift oc-env and evaluate the printed command in your shell. Example Minishift output on Windows CMD:
Run the SET command printed by minishift oc-env to update PATH for the current session:
After updating PATH you can log in as the cluster administrator:
The system:admin user has cluster-wide privileges and can access all system projects.

Using the REST API with curl

OpenShift exposes a REST API that you can call directly. In OpenShift 3.x, older resources live under /oapi; newer APIs use /api or /apis. To list projects via the API you need:
  1. TLS handling (skip verification for local Minishift clusters with -k, or provide the CA certificate with --cacert).
  2. An Authorization header containing a valid Bearer token.
Obtain a token using oc. Log in as the developer user and then get the token:
Retrieve the token for the current user:
Use that token in a curl request to the Projects endpoint. For local clusters you’ll commonly use -k to skip TLS verification:
A successful response returns JSON listing the projects you can access. Example (trimmed) response:
If you prefer not to use -k with curl, retrieve the OpenShift CA certificate from the cluster and use curl --cacert <path-to-ca.pem> instead.

Common commands and quick reference

Summary

  • The OpenShift web console is a user-friendly way to browse builder images/templates and manage Projects and application resources.
  • The oc CLI (bundled with Minishift) enables scripting and automation for builds, deployments, and cluster administration.
  • Use minishift oc-env to print the commands needed to configure your shell to use the oc binary shipped with Minishift.
  • Use oc whoami -t to obtain a token that can be used with curl when calling the OpenShift REST API.
That’s it for this lesson.

Watch Video