On this page
Kubernetes Addons module for Terraform
Common addons for Equinix Metal K8s Clusters
What is it?
The Kubernetes Addons Collection of Terraform modules provides reusable modules and examples that demonstrate how to install and configure common Kubernetes requirements for Equinix Metal Clusters using Terraform.
Why do we love it?
- Just enough Terraform: The modules in this collection are designed to work seamlessly in a Terraform deployment. We know this because these modules have been extracted from multiple Terraform deployment integrations. These add-ons help keep Terraform configuration DRY (Don't Repeat Yourself).
-
Nothing Extra: The collection modules are minimal. Helm already does an excellent job of consuming Kubernetes manifests to install and manage software. The Addons module does not support bare
kubectl apply -f
orhelm install
scripts unless there's a compelling reason. The most common reason is that the attributes needed to configure Kubernetes manifests are known only by Terraform at deployment time. - Open and Centralized: If you have Terraform configurations that are always included in your Equinix Metal Kubernetes stacks, consider opening a PR to share your work with others.
How do you use it?
The Kubernetes Addon project can be used as a root module or you can directly utilize the submodules. The root module exposes variables to enable and configure each of the submodules, and the outputs of each module are also available through the root module. The following sub-modules are included:
To utilize the Addons, you need a Kubernetes Cluster deployed on Equinix Metal. You can use the Equinix Metal Cloud Provider Kubernetes controller (CPEM) within the terraform-equinix-kubernetes-cluster by following the CPEM example in that Kubernetes Cluster Terraform module.
# Sample truncated to illustrate module use. See the example link above for the full code
# Create a Kubernetes Cluster
module "tfk8s" {
source = "equinix-labs/kubernetes-cluster/equinix"
# version = "0.2.1" # Use the latest version, according to https://github.com/equinix-labs/terraform-equinix-kubernetes-cluster/releases
metal_auth_token = var.metal_auth_token
kube_vip_version = var.kube_vip_version
kubernetes_version = var.kubernetes_version
metal_project_id = var.metal_project_id
cp_ha = var.cp_ha
worker_host_count = var.worker_host_count
metal_metro = var.metal_metro
cloud_provider_external = var.cloud_provider_external
}
# Install Addons within that cluster
module "kubernetes_addons" {
source = "equinix-labs/kubernetes-addons/equinix"
version = "0.4.0"
# **SNIP** (see the full example link above for working code)
# Wait to run add-ons until the cluster is ready for them
kubeconfig_remote_path = "/etc/kubernetes/admin.conf"
enable_metallb = false
enable_cloud_provider_equinix_metal = true
cloud_provider_equinix_metal_config = {
version = var.cpem_version
secret = {
projectID = var.metal_project_id
apiKey = var.metal_auth_token
loadbalancer = "kube-vip://"
}
}
}
Let us know about your experience with this project on the Equinix Community.
Interested in other Terraform deployment helpers? Let us know.
Last updated
10 October, 2024Category
Type
IntegrationsShare this
Ready to kick the tires?
Use code DEPLOYNOW for $300 credit