Creating a Terraform repository to deploy a Kubernetes cluster for educational purposes.
It creates three (3) QEMU/KVM virtual machines running Ubuntu 24.04 LTS, provisioned through Libvirt.
You need to edit Variables.tf
- timezone
- ssh port
- hostname
- vcpu
- vmem
- vol_size
and especially the Variable
- github user
... allowing you to access these VMs via SSH.
terraform init
terraform plan
using a bash shell script to automate creation
./start.sh
Apply complete! Resources: 16 added, 0 changed, 0 destroyed.
Outputs:
VMs = [
"192.168.122.223 k8scpnode1",
"192.168.122.50 k8swrknode1",
"192.168.122.10 k8swrknode2",
]
$ ssh -l ubuntu 192.168.122.223 hostname
k8scpnode1
$ ssh 192.168.122.223 -l ubuntu 'grep ^VERSION= /etc/os-release'
VERSION="24.10 (Oracular Oriole)"
run destroy bash shell script
./destroy.sh
If you need to set a root password for the Ubuntu 24.04 LTS virtual machine during its creation via Terraform
$ sudo virsh console k8scpnode1
userame: root
password: ping