This Terraform module allows you to deploy a Kubernetes cluster on Proxmox using k3s. The cluster will consist of server nodes for High-Availability and agent nodes for deploying workloads.
- Automated deployment of k3s Kubernetes cluster on Proxmox.
- High-Availability setup with server nodes.
- Customizable VM configurations (CPU, memory, disk size).
- Securely generate random k3s cluster token.
- Utilizes Docker for MariaDB database.
- Install Terraform (>= 0.12) on your local machine.
- Clone this repository to your local system.
- Modify the variables in
terraform.tfvars
to suit your needs. - Initialize Terraform:
terraform init
- Plan the infrastructure changes:
terraform plan
- Apply the changes to create the Kubernetes cluster:
terraform apply
- Proxmox API access with the required permissions to create VMs.
- Proxmox VM template for the Kubernetes nodes.
- SSH keypair for authentication to the VMs.
- Internet access on the VMs for package updates and installations.
Name | Description | Type | Default |
---|---|---|---|
proxmox_api_token_secret | The secret API token for Proxmox API access. | string | |
proxmox_api_token_id | The ID of the API token for Proxmox API access. | string | |
proxmox_api_url | The URL of the Proxmox API endpoint. | string | |
server_node_count | The number of server nodes for High-Availability. | number | 2 |
agent_node_count | The number of agent nodes in the cluster. | number | 3 |
k3s_version | The version of k3s to be installed. | string | "v1.26.3+k3s1" |
disk_size | Disk size for each Kubernetes node. | string | "30G" |
memory | Memory (RAM) for each Kubernetes node. | number | 3072 |
cores | Number of CPU cores for each Kubernetes node. | number | 4 |
ciuser | The default username for created VMs. | string | |
ssh_keys | SSH public key to add to VMs' authorized_keys. | string | |
ssh_private_key | Private SSH key for Terraform to SSH into VMs. | string | |
mariadb_database_size | Size of the MariaDB control plane database. | string | "20G" |
Name | Description |
---|---|
kubernetes_cluster_info | Variables for connecting to the Kubernetes cluster. Includes server IPs and the k3s token. |
server_ips | IP addresses of the server nodes in the Kubernetes cluster. |
... (Add more outputs as needed) |
This project is licensed under the MIT License.
Contributions, bug reports, and feature requests are welcome! Feel free to open issues and submit pull requests.