Provisioning with Terraform to deploy a High Availability Kubernetes cluster using K0s on MAAS (Metal as a Service) from Canonical.
-
Initialize Terraform:
terraform init
-
Export necessary variables:
export TF_VAR_url=<MAAS-URL> export TF_VAR_key=<API-KEY-4-MAAS> export TF_VAR_hostname_prefix=<KVM-HOST>
-
Plan the deployment:
terraform plan
-
Apply the deployment:
terraform apply
-
Destroy the deployment:
terraform destroy
- cloud_init_k0s.tftpl: Cloud-init template configuration for K0s setup.
- main.tf: Main Terraform configuration file.
- provider.tf: Provider configuration for Terraform.
- variables.tf: Variable definitions for Terraform.
To change the nodes, follow these steps:
-
Update the following variables:
worker_instances_count = 3 controller_instances_count = 2
Yes really that's all you need to do...
This code is intended for educational purposes only and includes a publicly known SSH key. It should not be used in production environments.
This project is licensed under the MIT License. See the LICENSE file for details.
This code was created in 2024 by Yves Wetter.