- Free IBM Cloud account, to create a new IBM Cloud account go here.
Pay-As-You-Goaccount. To upgrade a free IBM Cloud account, go here.
- IBM Cloud Shell,
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:
- An IBM Cloud Shell instance, image version 1.0.25
Login to IBM Cloud¶
- Using IBM Cloud Shell, you will already be logged in,
Using an external shell, log in to IBM Cloud,
IBMID=<your IBMID email> ibmcloud login -u $IBMID
If you are using federated SSO login, use the
Select the account in which the cluster was created.
Connect to IKS Cluster¶
KS_CLUSTER_NAMEenvironment variable to the correct cluster name,
KS_CLUSTER_NAME=<your cluster name>
Optionally, if you don't know your cluster name, list all clusters,
ibmcloud ks clusters
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\"')))'
Create an environment variable
$MY_NSfor the desired target namespace,
For IKS, download the cluster configuration to the client,
ibmcloud ks cluster config --cluster $KS_CLUSTER_NAME oc config current-context
The config should be set to a
Connect to OpenShift Cluster¶
For OpenShift, find the
oc logincommand 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 "IAMfirstname.lastname@example.org" 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¶
MY_NS=my-apps kubectl create namespace $MY_NS
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, go to Services.