This repository contains a Terraform module designed to deploy virtual machines that form a MicroK8s cluster using Xen-Orchestra. It creates a 3-node cluster by default but more nodes can be added dynamically.
module "microk8s_cluster" {
source = "../"
# Node settings
node_count = 0
node_prefix = "us20-k8s"
node_cpu_count = 2
node_memory_gb = 4
node_os_disk_size = 10
node_os_disk_xoa_sr_uuid = ["f5476a1f-03ad-f4fb-ed42-82397ff9a211"]
node_xoa_template_uuid = "5cd9d957-fc99-cb17-7550-777204797183"
# Master settings
master_count = 3
master_prefix = "us20-k8s"
master_cpu_count = 8
master_memory_gb = 8
master_os_disk_size = 10
master_os_disk_xoa_sr_uuid = ["cf62bbaf-8107-19cb-9b8c-62cbf28d2f52"]
master_xoa_template_uuid = "499cad8b-dff9-cfa9-cc18-719184d85747"
# Xen Orchestra settings can be set via environment variables
#xoa_username => XOA_USERNAME
#xoa_password => XOA_PASSWORD
#xoa_ignore_ssl => XOA_IGNORE_SSL
#xoa_api_url => XOA_API_URL
xoa_pool_name = "my-xcp-ng-pool"
xoa_network_name = "[95] Kubernetes"
start_delay = 0
# Other settings
public_ssh_key = "ssh-rsa AAAAB3N..."
dns_zone = "example.com."
dns_sub_zone = "k8s"
cluster_dns_zone = "k8s.example.com."
cluster_name = "cluster"
}| Name | Version |
|---|---|
| terraform | >= 1.0 |
| macaddress | >=0.3.0 |
| null | >=3.2.3 |
| random | >=3.6.3 |
| sshcommand | >=0.2.2 |
| xenorchestra | 0.29.0 |
| Name | Version |
|---|---|
| macaddress | 0.3.2 |
| null | 3.2.3 |
| random | 3.6.3 |
| sshcommand | 0.2.2 |
| xenorchestra | 0.29.0 |
No modules.
| Name | Type |
|---|---|
| macaddress_macaddress.mac_master_primary | resource |
| macaddress_macaddress.mac_master_secondaries | resource |
| macaddress_macaddress.mac_nodes | resource |
| null_resource.sleep_while_master_readies_up | resource |
| random_integer.master | resource |
| random_integer.node | resource |
| random_uuid.custom_token | resource |
| sshcommand_command.get_kubeconfig | resource |
| xenorchestra_cloud_config.master | resource |
| xenorchestra_cloud_config.node | resource |
| xenorchestra_cloud_config.secondary | resource |
| xenorchestra_vm.master | resource |
| xenorchestra_vm.node | resource |
| xenorchestra_vm.secondary | resource |
| xenorchestra_network.master | data source |
| xenorchestra_network.node | data source |
| xenorchestra_pool.xcp_ng_master | data source |
| xenorchestra_pool.xcp_ng_node | data source |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| cloud_network_config_template | Template for cloud network config | string |
"network:\r\n version: 1\r\n config:\r\n - type: physical\r\n name: eth0\r\n subnets:\r\n - type: dhcp\r\n" |
no |
| cluster_dns_zone | DNS zone for the cluster | string |
n/a | yes |
| cluster_name | Name used in the virtual machine names, not an actual Kubernetes settings | string |
"my-cluster" |
no |
| dns_sub_zone | DNS sub-zone | string |
n/a | yes |
| dns_zone | DNS zone | string |
n/a | yes |
| install_k8s_image_swapper | This will add the chart by default to use the k8s-image-swapper and save on imagePulls to Dockerhub, which are rate-limited | bool |
false |
no |
| k8s_image_swapper_private_registy | Point this to the FQDN of a private registry so the k8s-image-swapper can pull from there. Has no effect if install_k8s_image_swapper is unused |
string |
"" |
no |
| master_count | Number of master nodes to deploy | number |
3 |
no |
| master_cpu_count | Number of CPUs for each master node | number |
2 |
no |
| master_expected_cidr | Expected CIDR for master nodes, used for checking if the virtual machine is now ready. Replaces the old wait_for_ip |
string |
"10.0.0.0/16" |
no |
| master_memory_gb | Memory in GB for each master node | number |
4 |
no |
| master_os_disk_size | OS disk size in GB for each master node | number |
32 |
no |
| master_os_disk_xoa_sr_uuid | Storage repository UUID for master node OS disks | list(string) |
n/a | yes |
| master_prefix | Prefix for master node names | string |
"us20-k8s" |
no |
| master_tags | Tags to apply to master nodes | list(string) |
[ |
no |
| master_xoa_network_name | Network name for master nodes in Xen Orchestra (overrides xoa_network_name) |
string |
null |
no |
| master_xoa_pool_name | Name of the Xen Orchestra pool for master nodes (overrides xoa_pool_name for masters) |
string |
null |
no |
| master_xoa_template_uuid | Template UUID for master nodes in Xen Orchestra | string |
n/a | yes |
| microk8s_version | The snap channel version to install, for example 1.29/stable. Defaults to latest if not specified |
string |
null |
no |
| node_count | Number of worker nodes to deploy | number |
0 |
no |
| node_cpu_count | Number of CPUs for each worker node | number |
4 |
no |
| node_expected_cidr | Expected CIDR for nodes, used for checking if the virtual machine is now ready. Replaces the old wait_for_ip |
string |
"10.0.0.0/16" |
no |
| node_memory_gb | Memory in GB for each worker node | number |
8 |
no |
| node_os_disk_size | OS disk size in GB for each worker node | number |
32 |
no |
| node_os_disk_xoa_sr_uuid | Storage repository UUID for worker node OS disks | list(string) |
n/a | yes |
| node_prefix | Prefix for worker node names | string |
"us20-k8s" |
no |
| node_tags | Tags to apply to worker nodes | list(string) |
[ |
no |
| node_xoa_network_name | Network name for worker nodes in Xen Orchestra (overrides xoa_network_name) |
string |
null |
no |
| node_xoa_pool_name | Name of the Xen Orchestra pool for worker nodes (overrides xoa_pool_name for nodes) |
string |
null |
no |
| node_xoa_template_uuid | Template UUID for worker nodes in Xen Orchestra | string |
n/a | yes |
| private_ssh_key_path | Private SSH key path for accessing the nodes | string |
"/root/.ssh/id_rsa" |
no |
| public_ssh_key | Public SSH key for accessing the nodes | string |
n/a | yes |
| start_delay | The amount of time the cluster virtual machines will wait on XCP-NG host startup | number |
0 |
no |
| tags | A list of key+value pairs to apply to the deployment | list(string) |
[] |
no |
| xoa_network_name | Default network for virtual machines as seen in Xen Orchestra | string |
null |
no |
| xoa_pool_name | Default name of the XCP-ng pool as seen in Xen Orchestra | string |
null |
no |
| Name | Description |
|---|---|
| kubeconfig | n/a |
| master_hostnames | n/a |
| master_ips | n/a |
| node_hostnames | n/a |
| node_ips | n/a |
| primary_master_hostname | n/a |
| primary_master_ip | n/a |
This project is licensed under the MIT License. See the LICENSE file for details.