Anthos Series Part 1 : Bring up an application in Kubernetes on IBM, Google, Microsoft
This blog is part of a series to get you some idea about Google Anthos. Google Anthos has many features like Multi-cluster management, Ingress, Service Mesh, Binary authorization, Marketplace…etc . In this Blog series, I will talk about setting up the multi-cluster management (Anthos Connect). Connect allows you to connect any of your Kubernetes clusters to Google Cloud Read more about it here : https://cloud.google.com/anthos/multicluster-management/connect/overview
NOTE : This blog doesn’t have any specifics about Google Anthos. Use this blog as a pre-requisite and wait for my next blog for Anthos configuration.
In this blog I will explain about setting up Managed Kubernetes cluster in a few major service providers such as IBM, Google, and Microsoft.
If you want to setup a private Kubernetes cluster read my previous blog https://medium.com/@srpillai/single-node-kubernetes-on-centos-c8c3507e3e65
Make sure you have a workstation (Preferably a Linux distribution) for running the commands. I use an Ubuntu 18.04 machine to explain the steps below.
Setting up a Kubernetes cluster in IBM
You need to have an IBM Cloud Account with pay-as-you-go enabled to have a free cluster created. Once you setup your IBM Cloud Account follow the steps in this link to install IBM Cloud CLI : https://cloud.ibm.com/docs/cli
curl -sL https://ibm.biz/idt-installer | bash
Once you have IBM Cloud CLI setup and authenticated to IBM cloud run the following commands to bring up the Kubernetes cluster,
ibmcloud ks init --host https://us-south.containers.cloud.ibm.com
ibmcloud ks cluster create classic --name my_cluster
ibmcloud ks cluster config --cluster ibm-cluster
This will take approximately 15–20 mins. Once it is done successfully, you can run your application,
kubectl create deployment web --image=httpd
kubectl expose deployment web --type=LoadBalancer
Here is a short video of these steps in action,
NOTE: In the free account, you wont be able to expose the application to public as the Loadbalancer service is not free in IBM cloud.
Setting up a Kubernetes cluster in Google
You need to have a Google Cloud Account enabled to have a free cluster created. Once you setup your Google Cloud Account, follow the steps in this link to install Google Cloud CLI : https://cloud.google.com/sdk/docs/quickstart-debian-ubuntu
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.listcurl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -sudo apt-get update && sudo apt-get install google-cloud-sdk
Once you have Google Cloud CLI setup and authenticated to Google cloud, run the following commands to bring up the Kubernetes cluster,
gcloud init
gcloud container clusters create google-cluster --zone us-central1-c
gcloud container clusters get-credentials cluster-name
This will take approximately 3–6 mins. Once it is done successfully, you can run your application,
kubectl create deployment web --image=httpd
kubectl expose deployment web --type=LoadBalancer
Here is a short video of these steps in action,
Setting up a Kubernetes cluster in Microsoft Azure
You need to have an Azure Cloud Account enabled to have a free cluster created. Once you setup your Azure Cloud Account, follow the steps in this link to install Azure Cloud CLI : https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bashaz aks install-cli
Once you have Azure Cloud CLI setup and authenticated to Azure cloud, run the following commands to bring up the Kubernetes cluster,
az group create --name AKSResources --location eastusaz aks create --resource-group AKSResources --name azure-cluster --node-count 1 --generate-ssh-keysaz aks get-credentials --resource-group AKSResources --name azure-cluster
This will take approximately 5–10 mins. Once it is done successfully, you can run your application,
kubectl create deployment web --image=httpd
kubectl expose deployment web --type=LoadBalancer
Here is a short video of these steps in action,
Hope this is useful for you to bring up your Kubernetes on various clouds. I have not described the steps for AWS, because AWS Kubernetes service doesn’t fit in the free tier.
Wait for my next blog for managing all these clusters under one Google Anthos umbrella.