# Cloud Shell Setup Instructions

This section will guide you through the pre-requisites and setup of the environment used in this workshop labs. It is broken up into the following steps:

1. [Sign up for IBM Cloud](#1-sign-up-for-ibm-cloud)
2. [Login to IBM Cloud](#2-login-to-ibm-cloud)
3. [Open Cloud Shell](#3-open-cloud-shell)
4. [Connect to OpenShift Cluster](#4-connect-to-openshift-cluster)

## 1. Sign up for IBM Cloud

You will need an IBM Cloud ID for the workshop. If you already have an IBM Cloud ID, proceed to the next section. To create an ID:

* Follow the steps outlined in [NEWACCOUNT](https://github.com/IBM/cloudpakforapplications-appmod-workshop/tree/0264f42f6a54c442f8903ba106b24fd2a498c0c5/workshop/pre-work/NEWACCOUNT.md).

## 2. Login to IBM Cloud

To login to IBM Cloud,

1. Go to <https://cloud.ibm.com> in your browser and login.
2. Make sure that you are in the correct account#.

   ![Account Number](https://3805880268-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1Bh2a26msY5M4vW3R9%2Fsync%2F383d9b39ff6e7a449cb6c7cdfcccd63c5ea18025.png?generation=1595447213342292\&alt=media)

> Note: you may not have access to your OpenShift cluster if you are not in the right account#.

## 3. Open Cloud Shell

Most of the labs will run CLI commands. The IBM Cloud Shell is 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. From the [IBM Cloud Home Page](https://cloud.ibm.com), select the terminal icon in the upper right hand menu.

   ![Terminal Button](https://3805880268-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1Bh2a26msY5M4vW3R9%2Fsync%2F4e3ef8a0e00a226609704936c4ea8ef92ca906ca.png?generation=1591054953731762\&alt=media)
2. It might take a few moments to create the instance and a new session which automatically logs you in through the IBM Cloud CLI.

   ![Cloud Shell](https://3805880268-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1Bh2a26msY5M4vW3R9%2Fsync%2F2970c820f29e52209897b64523e8b1c9f43ad6dd.png?generation=1593182705265207\&alt=media)

   > *Note: Ensure the cloud shell is using the same account where your cluster is provisioned. Check that the account name shown in the top right of the screen, next to `Current account` is the correct one.*

## 4. Connect to OpenShift Cluster

1. In a new browser tab, go to <https://cloud.ibm.com/kubernetes/clusters?platformType=openshift>.
2. Select your cluster instance and open it.
3. Click `OpenShift web console` button on the top.
4. Click on your username in the upper right and select `Copy Login Command` option.

   ![Terminal Button](https://3805880268-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1Bh2a26msY5M4vW3R9%2Fsync%2F56325ed4139fbc9b821e66e602b696b6565a35f7.png?generation=1595447212566331\&alt=media)
5. Click the `Display Token` link.
6. Copy the contents of the field `Log in with this token` to the clipboard. It provides a login command with a valid token for your username.
7. Go to the `Cloud Shell` tab.
8. Paste the `oc login command` in the IBM Cloud Shell terminal and run it.
9. After login to your cluster, set an environment variable for your cluster.

   ```
   export CLUSTER_NAME=<your_cluster_name>
   ```
10. Verify you connect to the right cluster.

    ```
    kubectl get pod
    ```
