Kubernetes The Hard Way on Azure notes from the field

Ivan Fioravanti
4 min readSep 13, 2017

--

It’s time to try manual installation of a cluster using Kelsey Hightower detailed walkthrough: Kubernetes The Hard Way

It describes all steps needed to provision cloud resources, install Kubernetes cluster, configure it properly and run it on Google Cloud Platform. I discovered GCP following this tutorial and you should give a try to see how easy and fast it is.

To make things harder I decided to follow same procedure but on Microsoft Azure Cloud Platform and here is the result of my journey: Kubernetes The Hard Way on Azure github repository!

And here follows some quick lessons learned around it. But first things first.

Acknowledgements

There are many wonderful people to whom I am grateful for helping me learning Kubernetes and more.

I discovered so much on Google Cloud Platform and on Microsoft Azure and on Kubernetes, while translating this walkthrough and in particular:

Thank you Johnathan Carter for the translation job done in your repository, it was an invaluable help for me. Without your help this could have taken a long long time.

Thank you Kesley Hightower for the amazing and always updated walkthrough “Kubernetes The Hard Way” that is a must for learning #k8s and Google Compute Engine. I used GCP here for the first time and I feel like a Google Cloud Ninja Apprentice. I want to suggest his great book “Kubernetes: Up and Running” that is an invaluable resource to get a deep understanding of this incredible piece of technology.

Finally, I want to thank the many terrific developers who have contributed to Kubernetes. Hats off for making such an elegant, standard and extensible Container Orchestrator.

Here comes Kubernetes The Hard Way on Azure

As first step I searched for existing ways to do it. I found an old fork from Johnathan Carter – @lostintangent of January 2017 where he made the heavy work of translating Google language in Azure language. He is the real man behind Kubernetes The Hard Way on Azure.

I was excited and ready to start, but after a quick comparison, I discovered that a lot has changed in the Kubernetes world in the last 8 months and many steps changed, removed or added.

Kubernetes The Hard Way on Azure becomes a new repository

I decided to create a new fork and start this new adventure Kubernetes The Hard Way on Azure.

Note: After few steps I understood why Kesley decided to maintain only a single cloud provider, It was harder than I thought.

In this article I do not give detailed steps on how to install Kubernetes on Azure, that you can find in the Github repository, I want to highlight useful tips & tricks I learnt during the process.

Azure CLI 2.0 is the key to become an Azure Ninja

This is really important: if you want to become a real Azure Ninja, you have to install and learn how to use Azure CLI 2.0. It is an amazing new version of CLI done by Microsoft Azure team. When you will master it, you will feel like a superhero that can create tens of cluster, manage hundreds of VMs and deploy thousands of Containers with few simple commands.

Use it with a Shell on your machine or in the cloud

I used it on Linux and Mac machine and it gives its best when combined to Bash, Zsh or any Unix style sheel in general. This is why I suggest to use it on a shell (can it be used on a Windows 10 PC using the great build in Ubuntu VM? I should give it a try).

Note: in general you can use the Azure Cloud Console directly, but for this specific walkthrough you will need to install third party libraries like cfssl for certificates & C., generate and transfer files and I suggest doing this on your PC.

Google Metadata -> Azure Instance Metadata? Not yet

During Compute Resources step Kesley uses Google Metadata to add a POD-CIDR IP address to each node. This IP is used later in additional steps to configure network routing needed for Pods to communicate correctly.

I tried to figure out how to translate this Metadata concept on Azure and I found Azure Instance Metadata Service. In the linked article only Windows is mentioned but it works on Linux too. The only problem is that you can only GET predefined metadata, without being able to add and query for custom ones.

I used a trick here adding a tag POD-CIDR where needed. You can have up to 15 key=value elements for each resource. The problem with this solution is that it can’t be queried from the VM directly, I used Azure CLI on my machine to run code like:

POD_CIDR=$(az vm show -g kubernetes — name worker-0 — query “tags” -o tsv)

SSH on GCP is easy! On Azure?

In Google connecting to a compute instance using ssh is as easy as writing:

gcloud compute ssh controller-0

It is really as simple as that! Amazing.

In Azure things are less straightforward, but probably I am missing something, in case please let me know in the comments and I will update everything to use a better way.

I used following snippet of code to connect with ssh to a machine using Azure CLI 2:

CONTROLLER=”controller-0"
PUBLIC_IP_ADDRESS=$(az network public-ip show -g kubernetes \
-n ${CONTROLLER}-pip — query “ipAddress” -otsv)
ssh $(whoami)@${PUBLIC_IP_ADDRESS}

Now it’s your turn!

As I said at the beginning of this article, I learned a lot on Kubernetes, GCP and Azure simply following Kelsey Tutorial. Give it a try, you will not regret it.

--

--

Ivan Fioravanti

Co-founder and CTO of @coreview, Apple, OpenAI, LLMs, GenAI, Langchain, Mensa member, Innovation lover, insatiable Reader.