/terraform-proxmox-kubernetes

This module deploys Kubernetes (via kubeadm) within a Proxmox environment.

Primary LanguageHCLMIT LicenseMIT

terraform-proxmox-kubernetes

WIP

Getting Started

This module utilizes my Proxmox Cloudinit Module, which gives a lot of customization out-of-the-box for Virtual Machines.

This module assumes you've followed the Getting Started section of the above-mentioned module. You will need an Ubuntu (preferably 22.04.x) Cloudinit Virtual Machine template to use this module.

Requirements

Name Version
terraform >=1.3.0
http 3.3.0
local 2.4.0
macaddress 0.3.2
null 3.2.1
proxmox 2.9.14
random 3.5.1
tls 4.0.4

Providers

Name Version
local 2.4.0
null 3.2.1
random 3.5.1

Modules

Name Source Version
certs ./modules/kubernetes_certificates n/a
control_planes ZacksHomeLab/cloudinit-vm/proxmox 1.7.1
ext_apiserver_lb ZacksHomeLab/cloudinit-vm/proxmox 1.7.1
workers ZacksHomeLab/cloudinit-vm/proxmox 1.7.1

Resources

Name Type
local_file.init_kubeadm_script resource
local_file.prepare_apiserver_lb resource
local_file.prepare_control_node_script resource
local_file.prepare_ext_apiserver_lb resource
null_resource.init_kubeadm resource
null_resource.join_kubeadm resource
null_resource.prepare_control_planes resource
null_resource.setup_additional_apiserver_lbs resource
null_resource.setup_ext_apiserver_lb resource
null_resource.setup_primary_apiserver_lb resource
random_password.apiserver_keepalived_pass resource
random_password.ext_apiserver_keepalived_pass resource
random_string.prefix resource
random_string.suffix resource

Inputs

Name Description Type Default Required
apiserver_dest_port (String) The default destination port the apiserver will liste on. Default is 6443. number 6443 no
apiserver_lb_port (String) The default port for the Apiserver LB will listen on. Default is 6443. number 6443 no
apiserver_lb_type (String) The type of load balancer to use for the API Server. Valid values are 'haproxy' and 'kube-vip'. Default is 'haproxy'. string "haproxy" no
apiserver_lb_virtual_ip (String) The Virtual IP address (in CIDR-Notation) the load balancer will listen on. Note: This must be a routable IP that the Control Plane can access. Default is 192.168.2.100/24 string "192.168.2.120/24" no
cluster_domain The domain of your cluster (e.g., mycompany.local). Default is 'cluster.local' string "cluster.local" no
cluster_namespace (String) The cluster's namespace. Default is 'default' string "default" no
create_apiserver_lb (Bool) Whether to create an API Server Load Balancer on each Control Plane(s). Default is true. bool true no
create_certificates (Bool) Whether Terraform should generate the necessary certificates. Default is true. bool true no
create_control_plane (Bool) Determines if Control Node should be created or destroyed. bool true no
create_etcd_certificates "(Bool) Whether Terraform should generate the necessary certificates for etcd.
You would disable this functionality if you were to use a service other than etcd.

Default is true."
bool true no
create_ext_apiserver_lb (Bool) Determines if an External API Server Load Balancer should be created or destroyed. bool false no
create_worker (Bool) Determines if Worker Node(s) should be created or destroyed. bool true no
etcd_dest_port (Number) The destination port for etcd. Default is 2380. number 2380 no
etcd_src_port (Number) The source port for etcd. Default is 2379. number 2379 no
keepalive_router_id (Number) The Router ID for Keepalive. You would change this number if you have multiple clusters using this module and Keepalive. Default is 51. number 51 no
pod_network (String) Specify range of IP addresses for the pod network. If set, the control plane will automatically allocate CIDRs for every node. Default value is 10.244.0.0/16 string "10.244.0.0/16" no
pods_on_control_plane (Bool) Defines the ability to deploy Pods on the Control Plane node. Typically done in small clusters. Default is false. bool true no
private_key The private key file to connect to said Virtual Machine. string null no
service_network (String) Use alternative range of IP address for service VIPs. Default value is 10.96.0.0/12 string "10.96.0.0/12" no

Outputs

Name Description
control_planes_ip The primary IP addresses of each Control Plane Virtual Machine.
control_planes_ssh The ssh settings of each Control Plane Virtual Machine.
control_planes_vm_name The Virtual Machine Name of each Control Plane.
ext_apiserver_lb_ip The primary IP addresses of each External API Server Virtual Machine.
ext_apiserver_lb_ssh The ssh settings of each External API Server Virtual Machine.
ext_apiserver_lb_vm_name The Virtual Machine Name of each External API Server.
kube_token The kubenetes token used for joining node(s) to said cluster.