Set up Kubernetes cluster using KVM, Terraform and Kubespray
- Git
- Ansible >= v2.6
- Terraform == v0.12.x
- KVM - Kernel Virtual Machine
- Internet connection on machine that will run VMs and on VMs
Move to main directory:
cd terraform-kvm-kubespray
Change variables to fit your needs:
nano terraform.tfvars
Execute terraform script:
# Initializes terraform project
terraform init
# Shows what is about to be done
terraform plan
# Runs/creates project
terraform apply
Note: Installation proccess can take up to 20 minutes.
In terraform.tfvars file add:
- MAC address for new VM to
vm_worker_macs
and - IP address for new VM to
vm_worker_ips
.
Note: MAC and IP addresses for certain VM have to be on same index in array.
Execute terraform script to add worker:
terraform apply -var 'action=add_worker'
- TBD - (Not tested yet)
In terraform.tfvars file modify:
k8s_kubespray_version
andk8s_version
.
Execute terraform script to upgrade cluster:
terraform apply -var 'action=upgrade'
This script is modified to work with KVM instead of vSphere.
Script that works on vSphere can be found here.
In case you found a bug or dysfunctionality please open an issue.
If you need anything else contact me on GitHub.