openshift201
  • Introduction
  • Getting Started
    • Create Account and Get Cluster
    • Configure Shell Access
  • Workshop
    • Cloudant DB with IBM Cloud Operator
    • Configure the Sysdig Agent
    • Monitor your Cluster with SysDig
    • Configure the LogDNA Agent
    • Analyze your logs with LogDNA
  • Resources
    • Docs: Red Hat OpenShift on IBM Cloud
    • Docs: OpenShift Container Platform 4.3
Powered by GitBook
On this page
  • Use IBM Cloud Shell
  • Connect to the OpenShift cluster
  • Validate cluster access using oc commands
  • Install OpenShift CLI tools (Optional)

Was this helpful?

  1. Getting Started

Configure Shell Access

PreviousCreate Account and Get ClusterNextCloudant DB with IBM Cloud Operator

Last updated 5 years ago

Was this helpful?

To easily connect to the cluster, you need the OpenShift CLI oc that exposes commands for managing your applications, as well as lower level tools to interact with each component of your system.

This topic guides you through getting started with the CLI, including installation and logging in.

Use IBM Cloud Shell

To avoid installing the command line, the recommended approach is to use the IBM Cloud Shell is a cloud-based shell workspace that you can access through your browser.

It's preconfigured with the full IBM Cloud CLI and tons of plug-ins and tools that you can use to manage apps, resources, and infrastructure.

  1. In the Console menu bar, click the IBM Cloud Shell icon to start a session

  2. A session starts and automatically logs you in through the IBM Cloud CLI.

Connect to the OpenShift cluster

  1. In the OpenShift web console, click on the email/ID in the upper right. Choose the Copy Login Command option.

  2. In a Shell termimal, paste the login command you copied from the web console.

     oc login https://c100-e.us-south.containers.cloud.ibm.com:30360 --token=NYVkVysxxxxxxxxxxxxxxxxxxxxRQa8tM

    You should see a success message similar to the one below:

     oc login https://c100-e.us-south.containers.cloud.ibm.com:30360 --token=NYVkVysxxxxxxxxxxxxxxxxxxxxRQa8tM
    
     Logged into "https://c100-e.us-south.containers.cloud.ibm.com:30360" as "IAM#firstname.lasname@ibm.com" using the token provided.
    
     You have access to the following projects and can switch between them with 'oc project <projectname>'

Your CLI is now connected to your Red Hat OpenShift cluster running in IBM Cloud.

Validate cluster access using oc commands

  1. View nodes in the cluster.

     oc get node
  2. View services, deployments, and pods.

     oc get svc,deploy,po --all-namespaces
  3. View projects

     oc get projects

You've completed the getting started! Let's recap -- in this section, you:

  • Got an OpenShift cluster and accessed its Web Console.

  • Connected your local CLI to a running OpenShift cluster on IBM Cloud

Install OpenShift CLI tools (Optional)

The oc CLI will be the main mechanism to interact with your OpenShift cluster. We'll be downloading and installing the CLI, and adding it to your environment path.

Download the oc tarball.

wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz

Unpack the tarball

tar -xvzf openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz

Rename it for ease of use

mv openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit ${HOME}/oc-cli

Update PATH.

NOTE: If you restart your cloud shell, you may need to re-run this command.

export PATH=${PATH}:${HOME}/oc-cli

Verify the utility is available by using which and the help command.

which oc
oc help

NOTE: Check for newer releases on the page.

OpenShift Origin Releases
Access
Login
Copy the login credentials