For the hands-on labs of this workshop, you will need to either have tools installed on your workstation or use the IBM-provided web terminal. The web terminal has all tools pre-installed. If you are on a Windows 7 platform, or have not yet installed the tools listed below, you should use the web terminal.
If you have done the tasks in this section and are still using the same terminal/command window, you may navigate to Lab Environment Setup
at the end of this document.
Run these steps inside the console-in-a-browser environment provided by your instructor, or in a terminal/command window on your local machine.
-
Set environment variables
export USERNAME=user###
Note: replace ### with your assigned ID
export MYCLUSTER=$USERNAME-cluster
export SETUPURL="https://ibm.biz/app-mod-setup"
-
Login to the IBM Cloud. When asked to select an account, select "American Airlines' Account". Select 'us-south' as the region.
ibmcloud login --sso API endpoint: https://cloud.ibm.com Region: us-south Get One Time Code from https://identity-3.us-south.iam.cloud.ibm.com/identity/passcode to proceed. Open the URL in the default browser? [Y/n]> One Time Code > Authenticating... OK Select an account: 1. IBM (47b84451ab70b94737518f7640a9ee42) <-> 1323471 2. American Airlines (67eaa4b4b0b80862fab45beb6b22f002) <-> 1429869 Enter a number> 2 Targeted account American Airlines (67eaa4b4b0b80862fab45beb6b22f002) <-> 1429869 API endpoint: https://cloud.ibm.com API endpoint: https://cloud.ibm.com Region: us-south User: [email protected] Account: American Airlines (67eaa4b4b0b80862fab45beb6b22f002) <-> 1429869 Resource group: No resource group targeted, use 'ibmcloud target -g RESOURCE_GROUP' CF API endpoint: Org: Space: Tip: If you are managing Cloud Foundry applications and services - Use 'ibmcloud target --cf' to target Cloud Foundry org/space interactively, or use 'ibmcloud target --cf-api ENDPOINT -o ORG -s SPACE' to target the org/space. - Use 'ibmcloud cf' if you want to run the Cloud Foundry CLI with current IBM Cloud CLI context.
-
Target the
IksTraining-AA-RG
namespace:ibmcloud target -g IksTraining-AA-RG
-
List the clusters and locate the cluster corresponding to the userId you used to login to the console-in-a-browser environment. For example, if you are user028, your cluster will be user028-cluster.
ibmcloud ks clusters Clusters at version 1.11 and later run containerd instead of Docker as the Kubernetes container runtime. For more information and update actions, see <https://ibm.biz/Bd22hF> OK Name ID State Created Workers Location Version Resource Group Name user001-cluster 707f162b19cc4c3bbb28bfbfe85ee873 normal 2 days ago 2 Washington D.C. 1.11.8_1547 IKS-RG1 user026-cluster dcfb22a45c8e410e8d6f7a8269c2d0c3 normal 1 day ago 2 Washington D.C. 1.11.8_1547 IKS-RG1 user028-cluster 1b3398b985d84e9b8e9544a91d61428a normal 1 day ago 2 Washington D.C. 1.11.8_1547 IKS-RG1 user029-cluster 6d267a184154407d873f0b02159feb84 normal 1 day ago 2 Washington D.C. 1.11.8_1547 IKS-RG1
-
Configure your Kubernetes client using this command. This will also configure your Kubernetes client for future login sessions by adding the command into your .bash_profile. Edit the command before running replacing
<your user>
with the Username from the instructor. For example, if you haveuser005
, the cluster will beuser005-cluster
.eval $(ibmcloud ks cluster-config --cluster $USERNAME-cluster --export | tee -a ~/.bash_profile)
If the command has a syntax error in your terminal (e.g. windows cmd shell), you may instead run the command
ibmcloud ks cluster-config --cluster <your user>-cluster
. Then, copy the output and execute it in the same terminal. -
You should be able to use kubectl to list kubernetes resources. Try getting the list of pods (there should be none yet)
kubectl get pods No resources found.
-
Verify that you have the ikstraining-aa namespace.
ibmcloud cr namespaces Listing namespaces... Namespace ikstraining-aa OK
-
Login to the registry service
ibmcloud cr login Logging in to 'registry.ng.bluemix.net'... Logged in to 'registry.ng.bluemix.net'. IBM Cloud Container Registry is adopting new icr.io domain names to align with the rebranding of IBM Cloud for a better user experience. The existing bluemix.net domain names are deprecated, but you can continue to use them for the time being, as an unsupported date will be announced later. For more information about registry domain names, see https://cloud.ibm.com/docs/services/Registry?topic=registry-registry_overview#registry_regions_local Logging in to 'us.icr.io'... Logged in to 'us.icr.io'. IBM Cloud Container Registry is adopting new icr.io domain names to align with the rebranding of IBM Cloud for a better user experience. The existing bluemix.net domain names are deprecated, but you can continue to use them for the time being, as an unsupported date will be announced later. For more information about registry domain names, see https://cloud.ibm.com/docs/services/Registry?topic=registry-registry_overview#registry_regions_local OK
-
Verify you can list the images in the registry. You should see at least guestbook and mariadb, maybe a couple others.
ibmcloud cr images --restrict ikstraining-aa Listing images... REPOSITORY TAG DIGEST NAMESPACE CREATED SIZE SECURITY STATUS us.icr.io/ikstraining-aa/user001/guestbook v1 d4777e5bfffd appmod_aa 6 months ago 7.5 MB No Issues OK
-
Navigate to the working folder.
cd /userdata
To verify the connection to IBM Cloud and IKS cluster,
ibmcloud target
kubectl config view
Now you have logged into IBM Cloud and connected into your kubernetes cluster, you are ready to proceed to the steps in the lab.
https://github.com/IBMAppModernization/app-modernization-microservices-lab-iks