The shell scripts in this repo align directly with Kelsey Hightower's great Kubernetes The Hard Way tutorial. Kelsey's original tutorial is based on GCP.
These scripts have been written spefically for Microsoft Azure using the Azure CLI 2.0. After running through these scripts you'll have a fully bootstrapped Kubernetes cluster running in Azure.
It's "Medium-Hard" as we're still building the cluster from the ground up. By reading the scripts you'll still have full transparency into each step in the process. The whole point here is to learn the mechanics of a cluster. If you're looking for a managed Kubernetes solution on Azure look into Microsoft's Azure Kubernetes Service - AKS.
You will of course need an Azure Subscription to deploy into. In total you'll be spinning up 2 Availability Sets, 6 Managed Disks, 1 Load Balancer, 6 Network Interfaces, 1 Network Security Group, 7 Public IPs, 6 Virtual machines and 1 Virtual Network.
These scripts were built and tested on Ubuntu. Either run them from an Ubuntu machine or from the awesome Ubuntu on Windows which runs on top of the Linux Subsystem for Windows . Before starting, make sure that you have the Azure CLI installed. You'll want to be sure that you're logged in and that you have your target subscription selected.
First, open and update the params.sh file. The resourceRootName will be prepended to each resource that is created in Azure.
make sure to populate the adminUserName and SSHPublicKey parameters with valid values that you'd like the VMs configured with.
Leave the vNetCIDR and poCIDRStart values at thier defaults.
#!/bin/bash -e
# Parameters
# -----------------------------------------------------------
# Resource Group & Location
resourceRootName="kthw"
location="centralus"
# Network Info
vNetCIDR="10.240.0.0/24"
podCIDRStart="10.200.0.0/24"
adminUserName="ken"
SSHPublicKey=''
Review each of the below scripts before running. Execute them in order.
$ ./01-prerequisites.sh
$ ./02-client-tools.sh
$ ./03-compute-resources.sh
Create a directory to hold the certificates and configs and cd into it:
$ mkdir tls
$ cd tls
Review each of the below scripts before running. Execute them in order.
$ ../04-certificate-authority.sh
$ ../05-kubernetes-configuration-files.sh
$ ../06-data-encryption-keys.sh
$ ../07-bootstrapping-etcd.sh
$ ../08-bootstrapping-kubernetes-controllers.sh
$ ../09-bootstrapping-kubernetes-workers.sh
$ ../10-configuring-kubectl.sh
$ ../11-pod-network-routes.sh
$ ../12-dns-addon.sh
At this point you should have a fully functional cluster up and running. I've scripted a few smoke tests, but feel free to play around with your new cluster. Break it, fix it, etc ;)
$ ../13-smoke-test
Cleaning up is as simple as deleting the resource group that you've provisioned into.
- Azure CLI 2.0 - Azure Command Line Interface
- Visual Studio Code - The best code editor out there... Seriously.
- Windows Subsystem for Linux - Linux on Windows
Pull Requests Welcome
- Ken Skvarcius
- Kubernetes The Hard Way
- Many of the Azure CLI patterns are based on work from Jonathan Carter's fork of Kelsey's original work.