This article is the second in my series about IBM Cloud Kubernetes. This article requires that you have set up your IBM Cloud Kubernetes cluster. See my article IBM Cloud – Getting Started with a Free Kubernetes Cluster

In this article, we will download and install the IBM Cloud and Kubernetes CLI tools. We will then authenticate with IBM Cloud, with Kubernetes and run some basic commands. In the next article, we will deploy a Hello World application on Kubernetes.

Note: This article will recommend installing the tools differently than the documentation. The reason is if you follow the documentation the setup will fail.

Step 1 – Install the IBM Cloud CLI

The IBM Cloud CLI is a command-line tool for interfacing with IBM Cloud. This tool is also used for creating, developing, and deploying cloud applications.

For Windows, there are 32-bit and 64-bit versions. This article is written for Windows 10 Professional 64-bit.

Go to this page and download the Windows 64-bit Installer.

IBM Cloud CLI Releases

Once the download completes, launch the installer and complete the installation. Reboot your system once the installation completes.

The IBM Cloud command-line tools are installed to:

Install the Developer Tools CLI plug-in

Install the Object Storage CLI plug-in

Install the Container Registry CLI plug-in

Install the Kubernetes Service CLI plug-in

There are many more plug-ins that you can install.

IBM Cloud CLI Plug-ins

Verify the installed CLI plug-ins

Example output:

Step 2 – Install the Kubernetes CLI

Installing the IBM Cloud Kubernetes CLI is a bit of a mess. You need to know the version of your Kubernetes cluster and then download the matching kubectl version. At the time I wrote this article, this version 1.14.

Click on the following link and download kubectl.exe to a temporary directory:

Download kubectl version 1.14.8

  1. Open an elevated Command Prompt (Run as Administrator).
  2. Copy kubectl.exe to the IBM Cloud CLI installation directory. On my system this directory is C:\Program Files\IBM\Cloud\bin.

Verify the installed CLI programs

At a normal Windows Command Prompt:

Example output:

Step 3 – Log in to IBM Cloud

This step authenticates the CLI with IBM Cloud. You will need your email address and password for your account.

At a normal Windows Command Prompt:

List your IBM Cloud Kubernetes Clusters:

Example output:

Note the Name and Resource Group Name in the output. For my setup, the Resource Group Name is Default. Use the listed name for the next command.

Set the default Resource Group Name

Example output:

Step 4 – Set up the Kubernetes Cluster Context

Next, we will set up the CLI to communicate with your cluster. These commands must be run for each session of the CLI.

Set the Kubernetes Cluster Context

This command sets the cluster context, displays a command to set an environment variable and downloads the Kubernetes configuration files.

Example output:

Copy the command above that starts with SET KUBECONFIG. Run this command in the same command prompt. This command sets the environment variable KUBECONFIG to the path of the Kubernetes configuration file.

Display information about the Kubernetes cluster

Example output:

Display information about the Worker Nodes

Example output:

Display detailed information about the Kubernetes Cluster configuration

Example output:

Summary

The IBM Cloud and Kubernetes command-line tools are now set up. Spend some time learning about the various commands and options. In the next article, we will deploy a Hello World application on Kubernetes.

More Information

Credits

I write free articles about technology. Recently, I learned about Pexels.com which provides free images. The image in this article is courtesy of Michel Berube at Pexels.