-
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. -
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 ),
- 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.
This workshop was tested using:
- An IBM Cloud Shell instance, image version 1.0.25
-
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
-sso
flag instead. -
Select the account in which the cluster was created.
-
Set the
KS_CLUSTER_NAME
environment 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_NS
for the desired target namespace,MY_NS=my-apps
-
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
clustername/clusterid
pair,
-
For OpenShift, find the
oc login
command with the login token. To connect to a managedRed 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".
On Kubernetes,
MY_NS=my-apps
kubectl create namespace $MY_NS
On OpenShift,
MY_NS=my-apps
oc new-project $MY_NS
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.