Files
home-docker/terraform
2026-07-20 14:20:04 +10:00
..
2025-04-12 00:18:25 +10:00
2026-05-16 08:48:04 +10:00
2026-07-04 11:34:02 +10:00
2026-07-20 14:20:04 +10:00
2025-10-05 10:10:06 +11:00
2025-08-08 20:14:40 +10:00
2025-04-11 22:01:46 +10:00
2025-12-07 09:37:43 +11:00
2025-04-12 00:18:25 +10:00

K3s Cluster Setup with Terraform

This Terraform configuration sets up a k3s cluster on an existing virtual machine.

Prerequisites

  • Terraform installed on your local machine
  • SSH access to the target machine
  • SSH private key configured

Usage

  1. Initialize Terraform:
terraform init
  1. Apply the configuration:
terraform apply
  1. To destroy the cluster:
terraform destroy

Configuration

The main configuration is in main.tf. It uses the SSH provider to:

  1. Install k3s on the target machine
  2. Retrieve the node token
  3. Verify the node is running

Important Notes

  • Make sure your SSH private key has the correct permissions (600)
  • The k3s token will be output after successful installation
  • You can access the cluster using kubectl after copying the kubeconfig from the server