Skip to content

Instantly share code, notes, and snippets.

@No9
Last active May 5, 2020 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save No9/ab4a7aa32b73cb677b96f73635155fa2 to your computer and use it in GitHub Desktop.
Save No9/ab4a7aa32b73cb677b96f73635155fa2 to your computer and use it in GitHub Desktop.
IBM Cloud Workshop - Pre-Reqs

Prerequisites

This lab assumes that the reader is familiar with basic Kubernetes concepts. See the IBM Cloud Kubernetes Service Lab for a refresher of these concepts.

Before you begin, you need to install the required CLIs to manage your Kubernetes clusters. IBM provides an installer here to get all of these tools together. There are instructions for how to obtain the tools manually if desired. The following tools are used in this lab:

  • kubectl CLI
    • kubectl is a command line interface for running commands against Kubernetes clusters.
  • ibmcloud CLI
    • ibmcloud is a command line interface for managing resources in IBM Cloud.

This lab depends upon features such as an ingress controller which require a standard Kubernetes cluster. In order to create a standard cluster you must have either a Pay-As-You-Go or a Subscription IBM Cloud account. See https://cloud.ibm.com/docs/account/index.html#accounts for further information about account types.

Create a standard cluster using IBM Cloud Kubernetes Service

It is recommended to use the IBM Cloud dashboard to create a standard cluster because it will help guide you through the configuration options and it will show you the estimated cost.

  • Click the login button in the upper right and follow the login prompts to log into your account.
  • Click the hamburger menu at the top left of the screen
  • Click the Kubernetes --> Create Option on the menu of the window and then select the "Kubernetes" tile.
  • Click the Create button.
  • Fill in the form that appears. First select a location for your cluster as this will dictate the other options. Then choose a zone within the location and a machine type. Set the number of worker nodes to 2. Give a name to your cluster; for this lab we'll use "myStandardCluster".
  • Please ensure you select 1.15.11 version
  • Review the cost estimate on the right side of the window.
  • Click the Create Cluster button.

Now we'll continue using the command line. Log in to the IBM Cloud CLI and enter your IBM Cloud credentials when prompted.

ibmcloud login

Note: If you have a federated ID, use ibmcloud login --sso to log in to the IBM Cloud CLI.

Check the status of your cluster as follows.

$ ibmcloud ks clusters
OK
Name                ID                                 State     Created          Workers   Location    Version
myStandardCluster   fc5514ef25ac44da9924ff2309020bb3   normal    12 minutes ago   2         Dallas     1.10.7_1520

If the cluster state is pending, wait for a moment and try the command again. Once the cluster is provisioned (state is normal), the kubernetes client CLI kubectl needs to be configured to talk to the provisioned cluster. Run ibmcloud ks cluster-config myStandardCluster which will create a config file on your workstation.

$ ibmcloud ks cluster config -c myStandardCluster
OK
The configuration for mycluster was downloaded successfully. Export environment
variables to start using Kubernetes.

export KUBECONFIG=/home/gregd/.bluemix/plugins/container-service/clusters/myStandardCluster/kube-config-hou02-myStandardCluster.yml

Copy the export statement that you get and run it. This sets the KUBECONFIG environment variable to point to the kubectl config file. This will make your kubectl client work with your new Kubernetes cluster. You can verify that by entering a kubectl command.

$ kubectl get nodes
NAME            STATUS    ROLES     AGE       VERSION
10.177.184.185   Ready     <none>    2m        v1.10.7+IKS
10.177.184.220   Ready     <none>    2m        v1.10.7+IKS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment