Skip to content

Instantly share code, notes, and snippets.

@lee-zhg
Last active March 27, 2020 00:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lee-zhg/0b36d6919d60f56e73cc87c8f7c43477 to your computer and use it in GitHub Desktop.
Save lee-zhg/0b36d6919d60f56e73cc87c8f7c43477 to your computer and use it in GitHub Desktop.

Helm Hands-on Lab

Lab Pre-requisites

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.

Lab Environment Setup

Run these steps inside the console-in-a-browser environment provided by your instructor, or in a terminal/command window on your local machine.

  1. Set environment variables

    export USERNAME=user###
    
    export MYCLUSTER=$USERNAME-cluster
    

    Note: replace ### with your assigned ID

  2. 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:              timro@us.ibm.com   
    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.
  3. Target the IksTraining-AA-RG namespace:

    ibmcloud target -g IksTraining-AA-RG
  4. 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   
  5. 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 have user005, the cluster will be user005-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.

  6. 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.
  7. Verify that you have the ikstraining-aa namespace.

    ibmcloud cr namespaces
    Listing namespaces...
    
    Namespace   
    ikstraining-aa
    
    OK
  8. 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
  9. 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
  10. Navigate to the working folder.

    cd /userdata
    

Verify the connection to IBM Cloud and IKS cluster

To verify the connection to IBM Cloud and IKS cluster,

ibmcloud target
kubectl config view

Lab Repo

Now you have logged into IBM Cloud and connected into your kubernetes cluster, you are ready to proceed to the steps in the lab.

Skip Lab 0 and go directly to Lab 1. You will do lab 1, 2, 3, and 4.

https://github.com/IBMAppModernization/helm101/tree/master/tutorial
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment