Terraform AKS baseline clusters - deployment walkthrough
What you'll learn
- Create AKS clusters with Azure CLI and Terraform CLI
- Be able to deploy an AKS baseline cluster based on the reference from Azure Architecture Center
- Understand how (and where) to change Terraform variables to configure the cluster
- How to wrap Azure CLI in bash shell scripts to make it idempotent
- You should know the basics of Azure such as using the Azure portal, working with Resource Groups, and networking resources such as Virtual Networks, Subnets and Route Tables.
- You should be comfortable working with Command Line tools such as Azure CLI and kubectl in a Linux environment, and executing shell scripts in a terminal. Although we'll use the Azure portal to review a few things, most of our time will be working with text files in an Integrated Development Environment, and running commands in the built-in terminal.
- You should have some familiarity with the the essentials of Kubernetes, such as namespaces, deployments, and pods, but if you have used Docker's play-with-k8s labs or run a local Minikube cluster, that will be enough.
- You should understand the Infrastructure as Code concept of **declarative** resources - *the desired outcome* rather than the **imperative** approach of *the steps to get there*
In this course, we're going to deploy AKS clusters using different Infrastructure as Code approaches. Some of the key topics that we'll cover include:
Creating a cluster with Azure CLI
Using the Azure CLI in an idempotent way, so you can run and re-run the code without generating warnings and errors
We'll switch to using Terraform, and see how useful the module for Azure AKS is, which may be all you need to spin up some test clusters
We'll spend the bulk of the course on walking through the AKS Baseline Cluster from the Azure Architecture Centre, but converted from a massive Azure Bicep file into individual Terraform resources which are considerably easier to understand. This will enable you to use Terraform variables to toggle the creation of the resources you need in your own context.
Launch your first AKS cluster in 15 minutes with Azure CLI. We turn the steps in the Azure quickstart tutorial into idempotent bash shell scripts, so you can run them again and again. We'll run through the full process, including deploying an application to the cluster, and then deleting the cluster, resource group and Kubernetes context.
Create an Azure storage account and container to store Terraform state. We'll use bash shell scripts to wrap Azure CLI commands to create a backend for Terraform, and set up the storage firewall to allow access from your IP address.
Create the Minimum Viable Product in Terraform - using a remote backend to maintain state, take an Azure resource group through the Terraform lifecycle of init, plan, apply, destroy.
A cluster in 15 minutes - this time via Terraform. Use the official Azure Terraform Module to create a cluster in minutes. Similar to creating a cluster with Azure CLI, the Terraform code will create a resource group, virtual network, subnet, and AKS cluster.
Split code into subscription, hub, spoke, and cluster. Use Terraform's count keyword, combined with boolean variables to control the creation of resources. Prepare your code for production by a separation of concerns into hub and spoke networking, and choose whether to use the expensive Azure Firewall for your outbound routing.
Who this course is for:
- Cloud Engineer with experience on a different public cloud, or bare metal. You've worked with managed Kubernetes on a different cloud provider (AWS EKS, Google GKE, Oracle OKE) and want to get up to speed on AKS quickly
- Developer / DevOps. You want to better understand the infrastructure where your application runs, to make being on-call a nicer experience
- IT Operations. You know other Azure services, but haven't worked with AKS.
- Network Engineer. You come from a classical networking background, working with routers and switches, but you're being asked questions about Azure's Virtual Networks, route tables, and Azure Firewall.
Nick Romney is a seasoned, hands-on IT professional who’s bridged the gap between Ops and Dev teams for years - and most-recently helped a smaller bank on its journey to containerisation on Kubernetes whilst retaining the strict security controls expected of the financial sector.
He holds the U.K. Master’s degree standard Certified Information Systems Security Professional (CISSP) security qualification, paired with more than 20 certifications on Terraform, Kubernetes, Security, AWS, Azure, and Oracle Cloud Infrastructure.