Skip to content

Latest commit

 

History

History
119 lines (78 loc) · 3.83 KB

setup1.md

File metadata and controls

119 lines (78 loc) · 3.83 KB

Setup

Pre-requisities

  • Free IBM Cloud account, to create a new IBM Cloud account go here.

  • Free Pay-As-You-Go account. To upgrade a free IBM Cloud account, go here.

  • IBM Cloud Shell,

  • Kubernetes cluster:

    • IBM Cloud Kubernetes Service (IKS) v1.18 with a standard plan, a classic provider,
    • OR an Red Hat OpenShift Kubernetes Service v4.5 with a classic provider,
    • at least 2 worker nodes (with a subnet and public IPs, external LoadBalancer (for details about VLAN, subnets and IPs, see here ),

Setup Kubernetes Cluster

  • To use an IBM provided Kubernetes cluster with your IBM Cloud account and IBMId, grant access permissions to the cluster, as instructed here.
  • To connect to a managed Red Hat OpenShift Kubernetes Service (ROKS), go here.
  • To access a client terminal and OpenShift cluster at OpenLabs follow the instructions here.

Setup Client Terminal

This workshop was tested using:

Login to IBM Cloud

  1. Using IBM Cloud Shell, you will already be logged in,

  2. Using an external shell, log in to IBM Cloud,

    IBMID=<your IBMID email>
    ibmcloud login -u $IBMID
  3. If you are using federated SSO login, use the -sso flag instead.

  4. Select the account in which the cluster was created.

    Login to IBM Cloud

Connect to IKS Cluster

  1. Set the KS_CLUSTER_NAME environment variable to the correct cluster name,

    KS_CLUSTER_NAME=<your cluster name>
  2. Optionally, if you don't know your cluster name, list all clusters,

    ibmcloud ks clusters
  3. Or search for all clusters that contain a known substring,

    KS_NAME_SUB=<substring>
    ibmcloud ks clusters --output json | jq -r 'map(select(.name | contains('\"$KS_NAME_SUB\"')))'
  4. Create an environment variable $MY_NS for the desired target namespace,

    MY_NS=my-apps
  5. For IKS, download the cluster configuration to the client,

    ibmcloud ks cluster config --cluster $KS_CLUSTER_NAME
    oc config current-context
  6. The config should be set to a clustername/clusterid pair,

Connect to OpenShift Cluster

  1. For OpenShift, find the oc login command with the login token. To connect to a managed Red Hat OpenShift Kubernetes Service (ROKS), follow the instructions here. For example,

    $ oc login --token=e6PfXsQKjxiUf7qkb4jJxEd851pa0ZuUSEimVuGt4aQ --server=https://c114-e.us-south.containers.cloud.ibm.com:32115
    
    Logged into "https://c109-e.us-east.containers.cloud.ibm.com:31345" as "IAM#[email protected]" using the token provided.
    
    You have access to x projects, the list has been suppressed. You can list all projects with 'oc projects'
    
    Using project "default".

Create Namespace or Project

On Kubernetes,

MY_NS=my-apps
kubectl create namespace $MY_NS

On OpenShift,

MY_NS=my-apps
oc new-project $MY_NS

Get Helloworld Source Code

In this workshop, we will use a helloworld application. The source code, Maven build file, container images, and Kubernetes resource specifications are included in the repository. To get started, clone the helloworld repository to your client,

git clone https://github.com/remkohdev/helloworld.git
cd helloworld
ls -al

Next

Next, go to Services.