First off this may be my last blog before Christmas and the New Year so I would love to wish everyone a Merry Christmas, Happy Holidays, and a Happy New Year. 2018 has been an awesome year and I am so looking forward to 2019 as well!
So I would like to share my experience installing Kubernetes on Azure Stack for my first time. In fact, it is my first time deploying Kubernetes on any platform so this was a learning experience.
So why Kubernetes? For myself I was recently “voluntold” that I was now leading a Kubernetes project within my organization where I work. I will be the first to admit that I have no experience with containers. I have installed Docker for Windows and I have tried to deploy containers in the past. So I spent some time on Pluralsight watching several sessions on Docker and Containers and Kubernetes to try and at least get a little more educated moving into this new project.
Prerequisites for Kubernetes on Azure Stack
Add Kubernetes to Marketplace
First thing we need to do is offer Kubernetes to our users in the Marketplace. The current version is a preview version at the time of this blog. The marketplace item is currently 0.3.0 and also will require that your Azure Stack is at least at version 1808. I am running the latest hotfix for 1809 and have already made available the Kubernetes marketplace item.
Create Subscription
We will need a dedicated subscription to deploy Kubernetes in. I create one called Kubernetes POC. Pretty simple to do if you have an offer configured for public. If not you will need to reach out to an operator to create an offer and assign it to your account.
Here is were one of my lessons I learned during my 2nd attempt to deploy Kubernetes on Azure Stack. If you have a plan configured with a default storage quota you will be limited to 2 TB of storage and 20 storage accounts. My Base Plan I created and assigned to my subscription is using the default Storage quota so I will be limited to 2 TB. Without thinking about that, the 2nd time I deployed I bumped up my Kubernetes masters to 5 and my Linux nodes to 5 as well. The deployment failed because I ended up hitting that storage quota and didn’t have enough storage to finish deployment of VM’s.
Ubuntu Image and Linux Extension
Next, make sure that you have added the correct Ubuntu image into your marketplace. At the time of this blog and for version 0.3.0 of the Kubernetes preview you will need at least the following:
Publisher: Canonical
Offer: UbuntuServer
Version: 16.04.201806120
SKU: 16.04-LTS
You will also need the correct version of the Custom Script for Linux 2.0 below. You need to make sure you have this exact version otherwise the deployment will fail.
Offer: Custom Script for Linux 2.0
Version: 2.0.6
Publisher: Microsoft Corp
Create the SSH Key
We will need a public and private SSH Key. I will link a good document that will get you started. You can also find the link on the Microsoft Docs website as well. The following blog is a good resource, How To Create SSH Keys With PuTTY.
I have another lessons learned to talk about. My first attempt at deploying Kubernetes on Azure Stack I created a SSH Key. I copied the key over to the configuration window when setting up the deployment. Everything worked and my Kubernetes deployment was successful. I went to SSH into one of my masters and couldn’t. I didn’t save the public and private SSH key. I just copied and pasted it to the Azure field. So, I had no access to connect to my new Kubernetes cluster. I am not sure if I could have done anything to fix this issue so I deleted the resource group and started all over again. The good thing is the entire deployment takes about 15 – 20 minutes on my 4 node Azure Stack.
Create an Service Principal Account
We will need to create a Service Principal account and assign it the right role on our Azure Stack. Microsoft has it documented very well on the Microsoft Docs Website Create A Service Principal Account.
Deploying Kubernetes Cluster
Now we have our prerequisites out of the way. We are ready to actually deploy our first Kubernetes cluster. We have our quotas set correctly, we have our subscription, we have our prerequisites. The rest is pretty standard.
The first screen is pretty basic information. Asking for the subscription you will be deploying this cluster to. If you are using a new or existing Resource Group. Then the location.
The Cluster Settings window will ask for various information. You will need to supply the admin Username for your Linux VM’s.
The SSH public Key will be required. Copy and paste it from the tool you used earlier to create your private and public SSH Key.
Now, the Master Profile DNS Prefix. This is what your region will be called. It is a unique name. According to Microsoft Docs they recommend to name it after your resource group you created. So I did. I will need to research this more when we start to deploy K8s into production.
At this point I stayed with the default settings for the Masters and the Linux Nodes. I went with 3 of each and stayed with the Standard_D2_v2 VM size for both.
You will need to enter your Service Principal Client ID and Service Principal Client Secret which you would have gotten when you created the Service Principal earlier.
Note: The Service Principal Client ID is alway referred to the Application ID in AAD. The Service Principal Client Secret is your Service Principle Key.
I choose to use managed Disk vs Blob Storage. I have no reason I did this but should research the pros and cons for each. So I will do that later before we move to production environment deployments.
The summary screen will just summarize what your values enter are. Verify everything is good and continue on.
Now the the legalize and Terms of use. Click create and off you go.
You can monitor you deployments. Here we can see my deployment was successful. This was my third attempt which isn’t bad. The first was successful but I didn’t save my SSH Key, the 2nd I ran out of storage because of my storage quota assigned to the plan I was using.
Once the deployment is complete you can now SSH enter one of your masters. At this point we are ready to manage our first Kubernetes cluster and deploy containers!
Management
There are a few tools you can use to manage your Kubernetes clusters. I will be playing with Helm and Tiller. Also, I will be getting very familiar with KubeCtl.
Final Thoughts
For my first time (sort of) deploying Kubernetes on Azure Stack I think I did a decent job. I ran into some issues but all of them seem to be based off my lack of knowledge on the subject. I am looking forward to learning more about Kubernetes on Azure and Azure Stack. As well as other platforms that I may be forced to use. I do have questions that I have reached out to other peers about. So I am hoping to have answer to those questions soon Also, I plan to blog more about Kubernetes as I learn.
Questions
I need to know how to scale up and scale out once I deploy a Kubernetes cluster in Azure Stack and Azure. I also want to know how soon the newest Kubernetes releases will be adopted by Azure and Azure Stack. Currently as of this post Azure and Azure Stack are using versions 1.11. Kubernetes is currently at 1.13. I also would like to know how the update process works with Kubernetes on Azure Stack.