# Access IBM Cloud Shell and get the code

For this workshop we'll be using the IBM Cloud Shell as work environment. The IBM Cloud Shell is a cloud-based shell that you can access through your browser. It is preconfigured with the full IBM Cloud CLI and other 3rd party CLIs like OpenShift's `oc`, Helm's `helm`, Kubernetes' `kubectl`, etc. You can find the list of installed plug-ins [here](https://cloud.ibm.com/docs/cloud-shell?topic=cloud-shell-plugins-tools).

## Step 1: Setup the IBM Cloud Shell terminal session

When using the IBM Cloud Shell, no client side setup is required for this workshop, it comes with all necessary CLIs (command line tools).

In your browser, login to the [IBM Cloud](https://cloud.ibm.com) Dashboard. **Make sure you select your own account** in the account list at the top, then click on the IBM Cloud Shell icon.

This opens a new browser tab with your IBM Cloud Shell session.

![](https://1980280846-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFGEw-4BAG72jtDCP4q%2Fsync%2Fd677f8a83d41a9a610e3f5979d112b7512f84e7f.png?generation=1598017440542050\&alt=media)

Note: Your workspace includes 500 MB of temporary storage. This session will close after an hour of inactivity. If you don't have any active sessions for an hour or you reach the 50-hour weekly usage limit, your workspace data is removed.

You should see you personal ID as `Current account: [User]'s Account'`:

![](https://1980280846-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFGEw-4BAG72jtDCP4q%2Fsync%2Fbdd7e67d39c4d962a743b30570716d24b2c739e0.png?generation=1598017441533112\&alt=media)

If you want to perform this workshop locally on your own workstation, you need a local terminal and the following tools:

* [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
* [curl](https://curl.haxx.se/download.html)
* [kubectl](https://kubernetes.io/docs/reference/kubectl/overview/)
* [yarn](https://yarnpkg.com)
* [mvn](https://maven.apache.org/ref/3.6.3/maven-embedder/cli.html)
* [Node.js](https://nodejs.org/en/)
* Java 9 or higher

## Step 2: Get the Code

In the IBM Cloud Shell execute the following command:

```bash
git clone https://github.com/IBM/cloud-native-starter.git
cd cloud-native-starter/security
ROOT_FOLDER=$(pwd)
echo $ROOT_FOLDER
```

## Step 3. Get Access to Kubernetes

Open provided Kubernetes cluster again in your browser tab, with the IBM Cloud web console. Switch from your **own** account to the provided **IBM account**.

* Switch back to the  **1840867-IBM** account by clicking on the account selection drop down in the top navigation bar.

![](https://1980280846-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFGEw-4BAG72jtDCP4q%2Fsync%2F8dbf336a47bed2fe465185497a0e88c62d74c28e.png?generation=1598017443506169\&alt=media)

* Click on your cluster.

![](https://1980280846-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFGEw-4BAG72jtDCP4q%2Fsync%2Fb61ebb92297e41d0708560a59bd76fb3964a12b2.png?generation=1598017439448883\&alt=media)

* Now select `Access` on the left-hand side, here you see all steps to access your Kubernetes Cluster in a terminal session. You can easily copy and paste the given commands.

![](https://1980280846-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFGEw-4BAG72jtDCP4q%2Fsync%2Ffa055e2dbaaa2048ee4b4b4756276a7ea79235fe.png?generation=1598017439457636\&alt=media)

* Go back to the open browser tab the open Kubernetes Cluster in the IBM Cloud web console.
  1.  Now select `Actions->Connect via CLI` on the right-hand side.

      ![](https://1980280846-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFGEw-4BAG72jtDCP4q%2Fsync%2Fc08e7684ff4e87bb77de99e94395de30983d2ff1.png?generation=1621425335736820\&alt=media)
* Now copy and paste all these commands in sequence in your open IBM Cloud Shell terminal session.

| Browser tab - IBM Cloud web console                                                                                                                                                                     | Broswer tab - IBM CLoud Shell                                                                                                                                                                           |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![](https://1980280846-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFGEw-4BAG72jtDCP4q%2Fsync%2Ff34e39e744da0d22d566b97f5530832f37bc66d6.png?generation=1621425336833085\&alt=media) | ![](https://1980280846-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFGEw-4BAG72jtDCP4q%2Fsync%2Fbdd7e67d39c4d962a743b30570716d24b2c739e0.png?generation=1598017441533112\&alt=media) |

_Note:_ To access the pre-provisioned IBM Cloud Kubernetes Cluster, select the correct account (1840867-Advowork) during login.

Example:

```bash
Select an account:
1. Thomas Südbröcker's Account (641XXXXXXXXe) <-> 123456
2. Advowork (e2bXXXXXXXX4) <-> 1840867
Enter a number> 2
```

## Step 4. Create an environment variable `$MYCLUSTER`

* Enter the following command to display the name of your cluster, its ID, and a few other things.

```bash
ibmcloud ks cluster ls
```

Example output:

```bash
Name                             ID                     State      Created        Workers   Location    Version                   Resource Group Name   Provider
mycluster-ams03-b3c.4x16         bsk19dhd0efh3hp3b05g   normal     1 day ago      2         Dallas      1.17.9_1534               default               classic
```

* Create an environment variable $MYCLUSTER that contains the name of your cluster, e.g.

```bash
export MYCLUSTER=your_pre_provisioned_clustername
```

> Congratulations, you have successfully completed this the setup. Awesome :star:
