- Automated scripts to provision a Kubernetes cluster on the Azure cloud, based on Terraform and Ansible.
- These scripts provision a Kubernetes cluster. The Kubernetes cluster has 1 master VMs and 2 node VMs, these numbers can also be configured when launching the Terraform script.
-
Instructions for installing Docker on Ubuntu:
https://docs.docker.com/install/linux/docker-ce/ubuntu/#set-up-the-repository
Authenticating a service principal with Azure Resource Manager.
- Export credentials through environment variables:
$ export AZURE_CLIENT_ID = "YOUR_AZURE_CLIENT_ID"
$ export AZURE_CLIENT_SECRET = "YOUR_AZURE_CLIENT_SECRET"
$ export AZURE_SERVICE_PRINCIPAL = "YOUR_AZURE_SERVICE_PRINCIPAL"
$ export AZURE_SUBSCRIPTION_ID = "YOUR_AZURE_SUBSCRIPTION_ID"
$ export AZURE_TENANT_ID = "YOUR_AZURE_TENANT_ID"
- Cleaning the environment:
$ make clean
- Create the environment for execution:
$ make setup
- Initialize a working directory containing Terraform configuration files:
$ make terraform-init
- Create an execution plan:
$ make terraform-plan
- Building the Infrastructure:
$ make terraform-apply
- Create a hosts file containing inventory information such as the IP addresses from Terraform output:
$ make ansible-inventory
- Execute the master playbook:
$ make ansible-playbook
File | Content |
---|---|
variables.tf | Configure Azure Provider as well as declare all the variables that we will use in all our Terraform configurations. |
var_values.tfvars | Assign values to variables. Terraform automatically loads them to populate variables. |
networks.tf | Instructions for creating the entire network infrastructure of the project. In this file the main VNET is created, the routes and the subnets for the VMs. |
storage.tf | Storage account with a container to store VHDs of Virtual Machines. |
security_group.tf | This file contains inbound and outbound rules for traffic flow. |
vm-.tf | Terraform configuration to provision the VMs. |
pip_nic.tf | Public IP address to connect to the VMs from the internet. |
ansible-inventory.sh | Creates Ansible inventory from Terraform output. |
File | Content |
---|---|
1-dependencies.yml | Installing Kubernetes' Dependencies. |
2-master.yml | Setting Up the Master Node. |
3-workers.yml | Setting Up the Worker Nodes. |
hosts | Host inventories. |
list.yml | Master playbook. The plays and tasks in each playbook listed will be run in the order they are listed. |
- Contact
E-mail: [email protected]