Skip to content

equinix-labs/terraform-equinix-kubernetes-cluster

Repository files navigation

terraform-equinix-kubernetes-cluster

Experimental integration run-pre-commit-hooks generate-terraform-docs

This is a Terraform project for deploying Kubernetes on Equinix Metal intended to allow you to easily deploy a kubernetes cluster.

Disclaimer: This repository is Experimental and supported by the user community. Equinix does not provide support for this project.

Prerequisites

Configure pre-commit: pre-commit install.

Run terraform init -upgrade and terraform apply.

Kubernetes Container Network Interface (CNI)

A Container Network Interface (CNI) plug-in is not installed by default in the root module. Even though this module will install a running cluster using kubeadm, it is recommended that users install a CNI plug-in to run applications.

This example will install flannel CNI plug-in

Module Documentation

The main README.md, the modules README.md and the examples README.md are populated by terraform-docs worflow job. The following sections are appended between the terraform-docs delimeters: Requiremenents, Providers, Modules, Resources, Inputs, and Outputs.

Module Release and Changelog Generation

The module git release and changelog are generated by the release workflow job. The release worflow follows the conventional commits convention. To submit a commit, please follow the commit message format guidelines. This job is set to run manually by default.

Example commit message: fix: disabled log generation for system services

For more examples, please see conventional commit message examples.

Examples

To view examples for how you can leverage this module, please see the examples directory.

Requirements

Name Version
terraform >= 1.0.0
equinix ~> 1.20.0
local 2.4.1
null 3.2.2
tls 4.0.5

Providers

Name Version
equinix ~> 1.20.0
local 2.4.1
null 3.2.2
tls 4.0.5

Modules

No modules.

Resources

Name Type
equinix_metal_bgp_session.k8s_cluster1_pool1_cp1 resource
equinix_metal_bgp_session.k8s_cluster1_pool1_cpx resource
equinix_metal_device.k8s_cluster1_pool1_cp1 resource
equinix_metal_device.k8s_cluster1_pool1_cpx resource
equinix_metal_device.k8s_cluster1_pool1_workerx resource
equinix_metal_port.k8s_cp1 resource
equinix_metal_port.k8s_cpx resource
equinix_metal_project_ssh_key.ssh_key_pair resource
equinix_metal_reserved_ip_block.k8s_cluster1_pool1_cp1 resource
local_sensitive_file.ssh_private_key_file resource
null_resource.kubeconfig resource
null_resource.wait_for_cloud_init resource
tls_private_key.ssh_key_pair resource

Inputs

Name Description Type Default Required
metal_auth_token Equinix provider user auth token string n/a yes
metal_project_id Equinix project ID string n/a yes
cloud_provider_external Toggle to enable name of the cloud provider to be passed to kubeadm. Ex: --cloud-provider='external' bool true no
cp_ha Whether to enable HA in Kubernetes control plane nodes bool true no
cpem_version Version of the CPEM string "v3.6.2" no
k8s_cluster_cp_billing_cycle Billing Cycle of the nodes in the control plane cluster string "hourly" no
k8s_cluster_cp_hostname Hostname of each node in the control plane cluster string "k8s-cluster1-pool1-cp" no
k8s_cluster_cp_os OS of the nodes in the control plane cluster string "ubuntu_20_04" no
k8s_cluster_cp_plan Plan of the nodes in the control plane cluster string "m3.small.x86" no
k8s_cluster_worker_billing_cycle Billing Cycle of the nodes in the worker cluster string "hourly" no
k8s_cluster_worker_hostname Hostname of each node in the worker cluster string "k8s-cluster1-pool1-worker" no
k8s_cluster_worker_os OS of the nodes in the worker cluster string "ubuntu_20_04" no
k8s_cluster_worker_plan Plan of the nodes in the worker cluster string "m3.small.x86" no
kube_vip_version KubeVip version of choice string "v0.6.2" no
kubernetes_version Kubernetes version. See https://www.downloadkubernetes.com/ string "v1.27.5" no
metal_metro Metro of choice string "da" no
ssh_private_key_path Path of the private key used to SSH into cluster nodes string "" no
tags String list of common tags for Equinix resources list(any)
[
"k8s-cluster-cluster1",
"k8s-nodepool-pool1"
]
no
worker_host_count Number of worker nodes number 1 no

Outputs

Name Description
cloud_init_done This ID will be set when the cloud-init --wait command exits
kubeapi_vip KubeVip IP Address
kubeconfig_ready This ID will be set when the kubeconfig has been copied to the local machine
ssh_key_pair SSH Key pair

Contributing

If you would like to contribute to this module, see CONTRIBUTING page.

License

Apache License, Version 2.0. See LICENSE.