Setting up Kubernetes cluster on Azure using Kubeadm, Terraform & Ansible- Part 1
Kubernetes (K8s), the hotshot of the decade, and de-facto choice for container orchestration have gained mammoth popularity since its initial release in 2015. It has now become the mandatory arrow in the quiver for any software engineers irrespective of domain & technology stack. And the best way to learn K8s is to actually deploy it by yourself from scratch, especially if you are preparing to appear for CKA certification and not using managed K8s cluster on various cloud platforms. We often are required to spin up and destroy K8s multiple times during our initial learnings. To avoid unnecessary efforts on setting up the cluster manually each time, it’s best to automate it. Hence I decided to write a blog post consisting of two-part series, to help everyone set up a single master node cluster with two worker nodes in Azure cloud platform using Terraform for setting up virtual machines and we will look into configuring these VMs to run K8s using Ansible in part-2 of this series. Now let’s get started with Terraform.
Getting started with Terraform: Infrastructure as Code
Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions.
- Users must have an Azure subscription and sufficient privileges to create required resources. To create a new Azure account, follow the below link
Create your Azure free account today | Microsoft Azure
Test and deploy enterprise apps Use Azure Virtual Machines, managed disks and SQL databases while providing high…
2. Download & Install of Terraform CLI
Download Terraform - Terraform by HashiCorp
- Terraform by HashiCorp Download Terraformwww.terraform.io
As part of the cluster setup, We will be created the following Azure resources:
- Resource Group
- Virtual Network
- Network Security Group
- Virtual Machines: bastion, master (1) & worker nodes (2)
Setting up base infrastructure:
The terraform code to set up the base infrastructure is available in the following repository
This repository is intended to spin up a Kubernetes cluster using kubeadm in Azure cloud The following…
In the next part of the series, as shared below, we shall look at ansible scripts to configure these virtual machines to spin up basic single master K8s cluster using kubeadm.