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.
Using Chrome or Firefox, go to the Cloud Shell.
Login using your IBMid email and Passcode that has been given during the training.
Click on the Terminal icon to launch your web shell.
Connect to IBM Cloud
Select your cloud account or the one provided by the trainer.
Login to IBM Cloud
ibmcloud login
Enter your IBMid email and password.
If you are using a Single-Sign-On authentication with IBMid, use ibmcloud login --sso.
Select an Account and a Region.
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).
In this lab, the Resource Group pyrk8s has been created. Select this resource group.
ibmcloud target -g lab
Verify you can see your cluster.
ibmcloud ks clusters
Retrieve the cluster configuration by setting MYCLUSTER environment variable to your cluster name:
ibmcloud ks cluster-config MY_CLUSTER_NAME
Copy and paste the displayed set command to set the KUBECONFIG environment variable as directed.
To verify whether the KUBECONFIG environment variable is set properly or not, run the following command:
echo $KUBECONFIG
Check that the kubectl command is correctly configured
kubectl cluster-info