Skip to content

Latest commit

 

History

History
67 lines (43 loc) · 1.42 KB

README.md

File metadata and controls

67 lines (43 loc) · 1.42 KB

Deploy AKS in custom VNET, with Kubenet plugin using Terraform

This repository contains all you need to use Terraform to deploy Azure Kubernetes Service with Kubenet plugin, inside a custom VNET.

It automatically creates:

  • A resource group
  • A virtual network with an address space of 10.1.0.0/16
  • A subnet named internal with an address range of 10.1.0.0/24 (where the AKS worker nodes will land)
  • An Azure Kubernetes Service cluster

How it works

All the AKS cluster definition is in the tf/aks.tf file. Some of the parameters are variable that can be overriden in the tf/variables.tf file.

How to deploy

You need to have Terraform installed and Azure CLI 2.0 installed, obviously.

Go to the tf directory:

cd tf

Optional: update the variables.tf and aks.tf files with desired values.

Export the following environment variables for the service principal client id and client secret that should be used by the Azure Kubernetes Service cluster:

export TF_VAR_client_secret=YOUR_CLIENT_SECRET
export TF_VAR_client_id=YOUR_CLIENT_ID

Initialize Terraform

terraform init

Plan the deployment:

terraform plan -out out.plan

Apply the plan to start the deployment:

terraform apply "out.plan"

Wait for the deployment to be completed.

How to destroy

Go to the tf directory:

cd tf

Call Terraform destroy:

terraform destroy