This project allows you to create a Kubernetes cluster on Proxmox VE using Terraform and Kubespray in a declarative manner.
Ensure the following software versions are installed:
- Proxmox VE
>=7.3.3
- Terraform
>=1.3.3
Kubespray has been set up automatically.
Before proceeding with the setup for Proxmox VE, make sure you have the following components in place:
- Internal network
- VM template
- SSH key pair
- Bastion host
Follow these steps to use the project:
-
Clone the repo:
$ git clone https://github.com/khanh-ph/proxmox-kubernetes.git
-
Open the
example.tfvars
file in a text editor and update all the mandatory variables with your own values. -
Initialize the Terraform working directory.
$ terraform init
-
Generate execution plan and review the output to ensure that the planned changes align with your expectations.
$ terraform plan -var-file="example.tfvars"
-
If you're satisfy with the plan and ready to apply the changes. Run the following command:
$ terraform apply -var-file="example.tfvars"
The project provides several Terraform variables that allow you to customize the cluster to suit your needs. Please see the following:
Below are the mandatory variables:
env_name
pm_api_url
pm_api_token_id
pm_api_token_secret
pm_tls_insecure
pm_host
internal_net_name
internal_net_subnet_cidr
bastion_ssh_port
bastion_ssh_ip
bastion_ssh_user
ssh_public_keys
ssh_private_key
vm_max_vcpus
vm_k8s_control_plane
vm_k8s_worker
You may also configure the following optional variables specific to Kubespray:
kube_version
kube_network_plugin
enable_nodelocaldns
podsecuritypolicy_enabled
persistent_volumes_enabled
helm_enabled
ingress_nginx_enabled
argocd_enabled
argocd_version
For more detailed instructions, refer to the following blog post: Create a Kubernetes cluster on Proxmox with Terraform & Kubespray