Deep Dive and Deploy onto IBM Cloud Kubernetes Service

mrinasugosh

Mrinalini Sugosh (Mrina)

Posted on September 10, 2021

Deep Dive and Deploy onto IBM Cloud Kubernetes Service

Welcome to THINK Days!

A weekly blog series where I discuss and share my journey with IBM Cloud Services. At some point most of us have come across containers and images that we have managed on our own DockerHub. And running a few containers on your own is fine, but what do you do when you're running hundreds or thousands? That's where you need a container orchestration and that's precisely where Kubernetes comes in.

What is Kubernetes?

Kubernetes is an open source project under the Cloud Native Computing Foundation(CNCF). It's around seven years young, has thousands of commits, and is a vibrant, well-supported
open source ecosystem with many vendors contributing to the project from IBM to Google to Microsoft to Amazon (you get this gist). In fact, there are over 150 certified Kubernetes providers on the market today!

The goal of Kubernetes is to make everything associated with deploying and managing your containers easier. This means it has automated rollouts and rollbacks which will scale your services up or down based on utilization. This ensures that you're only running what you need when you need it. It will monitor the health of your services to prevent bad roll outs. They will also continuously run health checks against your services and thereby restart containers that fail.

Most importantly, Kubernetes is built to be used anywhere, allowing you to orchestrate deployments to public clouds, private clouds, on premise, or even hybrid cloud deployments.

Kubernetes High Level Overview

The most common way that a System Administrator would interact with Kubernetes is through the kubectl CLI. This acts as the communication between System Admin and a specific Kubernetes Cluster.
The natural question is what is a cluster and how does that relate to my containerized images? Well, each cluster will have a master node and at least one worker node. Each worker node can support running multiple pods. Each pod is intern running an image of a containerized application.

IBM Cloud Kubernetes Service

IBM Cloud offers a fully managed Kubernetes service in a matter of minutes called IBM Cloud Kubernetes Service or IKS. You can spin up your own Kubernetes cluster, have access to worker nodes, and start deploying applications. IBM Cloud's Kubernetes service has many benefits:

  • fully managed
  • provides automatic upgrades
  • Security Compliance (PCI ,HIPAA, SOC1, and more)
  • configure as a single or multi zone cluster IKS also has several supported add-on benefits:
  • a service mesh or serverless onto your cluster.
  • logging and monitoring.

Let's dive a little deeper...

IKS can be deployed to any of the six regions on IBM Cloud. This includes North America, East, West, South, the APAC Region, Europe and South America.
There are different ways to deploy IBM Cloud Kubernetes service. The first is on a virtual shared instance. This will provision IKS on virtual machines.
Next is a virtual dedicated instance which is going to provision your cluster on a dedicated server. Note, that this is a single tenant instance.
Lastly, you can provision your Kubernetes cluster on a bare metal server.
Each type of deployment has multiple profiles ranging from 2vCPU to 512 gigabytes of RAM. The billing for IKS is hourly, monthly or even has a LITE option which is free for one cluster upto a certain limit.
There are two other services worth highlighting when discussing IKS:

IBM Cloud Container Registry

The first is the IBM Cloud Container Registry which is used to store container images in a fully managed multi-tenant registry. It's highly available as the service is hosted and managed by IBM Cloud. You can configure your images to be privately accessed by other users in your IBM Cloud
account shareable with API keys or even make them publicly available. Images in the container registry will also be scanned by the vulnerability advisor tool which makes it secure. If you would like a tutorial on this service, be sure to checkout my blog to Deploy a NodeJS app to IBM Cloud Container Registry

Helm Catalog

The other service is the Helm Catalog which is unique to IBM Cloud. It allows users to use helm to install and upgrade complex Kubernetes applications in a cluster. The helm catalog in IBM Cloud has access to IBM products, popular open source products, like Jenkins and Tecton, and supports multiple architectures like X86 power NZ.

Now that we have dived into the features and availabilities on IBM Cloud Kubernetes service let's take a look at how to deploy an app onto this.

Tutorial

Create a free Kubernetes cluster

Navigate to https://cloud.ibm.com to log into IBM Cloud. You'll be presented with an empty console. Click on the Catalog button on the top-right.
Screen Shot 2021-09-10 at 2.01.19 PM

From the catalog, choose the Kubernetes option.
Screen Shot 2021-09-10 at 2.02.59 PM

Choose the Free tier option, give your cluster a unique name and click Create.
Screen Shot 2021-09-10 at 2.04.03 PM

Launch the IBM Cloud Shell

Once your cluster is created click on the Actions menu on the top right, and choose the Connect via CLI option.
Screen Shot 2021-09-10 at 2.05.50 PM

Click on the clipboard to copy the command, the one using the ibmcloud ks cluster config command. This will set any kubectl commands to use your newly created cluster.

Screen Shot 2021-09-10 at 2.29.38 PM

Next, we'll be using the IBM Cloud Shell, which is available by clicking on the terminal icon on the top right.

Screen Shot 2021-09-10 at 2.38.13 PM

Once loaded, you'll be presented with an embedded web terminal that has the ibmcloud and kubectl CLIs available.
Screen Shot 2021-09-10 at 2.39.52 PM

Connect to your cluster

From the IBM Cloud Shell, run the following command, replacing your cluster ID in the command below.

ibmcloud ks cluster config --cluster <CLUSTER_ID>
Enter fullscreen mode Exit fullscreen mode

The output should look something like this:
Screen Shot 2021-09-10 at 2.41.25 PM

Deploy the application

For this tutorial, we'll run a sample IBM Sample App that detects objects in a picture. Deploy the application by running the command below.

kubectl apply -f https://raw.githubusercontent.com/IBM/MAX-Object-Detector/master/max-object-detector.yaml
Enter fullscreen mode Exit fullscreen mode

Screen Shot 2021-09-10 at 2.43.03 PM

Access the App via Public IP and Port

After a few minutes, the application should be available. To access it we need to find the public IP address of the cluster, and the port the application is running on.

To find the public IP address of the cluster run the command below:

ibmcloud cs workers --cluster <CLUSTER_ID>
Enter fullscreen mode Exit fullscreen mode

And to find the port the application is running on, run the following command:

kubectl describe service max-object-detector | grep NodePort
Enter fullscreen mode Exit fullscreen mode

Let's finally put it all together and access the app. From your browser navigate to the URL with the information above:

http://<public-ip-address:<port>/app
Enter fullscreen mode Exit fullscreen mode

Screen Shot 2021-09-10 at 2.50.55 PM

Oila! You have successfully deployed an app onto a cluster in IBM Cloud Kubernetes Service.

Thank you for following along this THINK Day's Tutorial and be sure to look out for my next post, where I will continue sharing my Journey with IBM Cloud Services!!!

==== Follow me on Social Media(@mrinasugosh) ====
Dev.to: @mrinasugosh
Github: @mrinasugosh
Twitter: @mrinasugosh
LinkedIn: @mrinasugosh

💖 💪 🙅 🚩
mrinasugosh
Mrinalini Sugosh (Mrina)

Posted on September 10, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related