Connect to your cluster via CLI

For this lab, a hosted shell is provided for you with all the necessary tools. Use this web shell to perform the tasks in this lab. If you are having problems with this web shell, you can use a local docker container and follow the instructions here instead.

  1. Using Chrome or Firefox, go to the Cloud Shell.

  2. Login using your IBMid email and Passcode that has been given during the training.

  3. Click on the Terminal icon to launch your web shell.

Connect to IBM Cloud

  1. Select your cloud account or the one provided by the trainer.

  2. Login to IBM Cloud

     ibmcloud login
    
  3. Enter your IBMid email and password.

    If you are using a Single-Sign-On authentication with IBMid, use ibmcloud login --sso.

  4. Select an Account and a Region.

  5. Once logged in you will see the following message:

     Targeted account IBM's Account (0b123456789) <-> 1594534
    
     API endpoint:      https://cloud.ibm.com
     Region:            eu-de
     User:              your-email-address@company.com
     Account:           IBM's Account (0b123456789) <-> 1594534
     Resource group:    No resource group targeted, use 'ic target -g RESOURCE_GROUP'
     CF API endpoint:
     Org:
     Space:
    

    If you need to switch to anoher region such as US-South, run the command ibmcloud target -r us-south.

Target your Resource Group

You need to target a Resource Group (RG) to view your cluster or to add a service (e.g. Cloudant Database). Access to the group and the resources within it are managed by using Identity and Access Management (IAM).

  1. In this lab, the Resource Group pyrk8s has been created. Select this resource group.

     ibmcloud target -g lab
    
  2. Verify you can see your cluster.

     ibmcloud ks clusters
    

    Output

  3. Retrieve the cluster configuration by setting MYCLUSTER environment variable to your cluster name:

     ibmcloud ks cluster-config MY_CLUSTER_NAME
    
  4. Copy and paste the displayed set command to set the KUBECONFIG environment variable as directed.

  5. To verify whether the KUBECONFIG environment variable is set properly or not, run the following command:

     echo $KUBECONFIG
    
  6. Check that the kubectl command is correctly configured

     kubectl cluster-info
    

    The output should look like:

results matching ""

    No results matching ""