Files
home-docker/terraform
2025-05-11 08:41:23 +10:00
..
2025-04-12 00:18:25 +10:00
2025-04-12 09:27:16 +10:00
2025-05-11 08:41:23 +10:00
2025-04-12 09:27:16 +10:00
2025-04-11 22:01:46 +10:00
2025-04-12 00:18:25 +10: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