Skip to content

PePoDev/terraform-kind-cluster

Repository files navigation

Kind Cluster

Pre-Commit LICENSE

Terraform module which creates Kubernetes Cluster resources on KIND (Kubernetes in Docker).

Usage

Basic Cluster Configuration

module "kind_cluster" {
  source  = "PePoDev/cluster/kind"
  version = "~> 0.1"

  cluster_name          = "kubernetes-problems"
  enable_metrics_server = true
  enable_loadbalancer   = true
}

Examples

Requirements

Name Version
docker ~> 2.15
kind ~> 0.0.9
kubectl ~> 1.11
kubernetes ~> 2.4
random ~> 3.1

Providers

Name Version
docker 2.15.0
kind 0.0.9
kubectl 1.11.3
kubernetes 2.4.1
random 3.1.0

Modules

No modules.

Resources

Name Type
kind_cluster.this resource
kubectl_manifest.kubectl_apply_loadbalancer resource
kubectl_manifest.kubectl_apply_metrics_server resource
kubernetes_config_map.loadbalancer_config resource
kubernetes_namespace.loadbalancer_namespace resource
kubernetes_secret.loadbalancer_secret resource
random_id.loadbalancer_secret_random resource
docker_network.kind_network data source
kubectl_file_documents.loadbalancer_manifests data source
kubectl_file_documents.metrics_server_manifests data source

Inputs

Name Description Type Default Required
cluster_name Cluster name to create k8s cluster in Docker and set kubeconfig, You can use this cluster name select context with kubectl. string n/a yes
containerd_config_patches Path config to existing default for containerd. list(string) [] no
enable_loadbalancer Set to true to enable loadbalance for kind cluster. bool false no
enable_metrics_server Set to true to install metrics server into cluster. bool false no
kubernetes_version Specific kubernetes version to create cluster, Must specific in SemVer version. (Check all supported version -> https://hub.docker.com/r/kindest/node/tags) string "1.21.1" no
node_image Change base image for kubernetes cluster, This parameter allow you to use local build image. string "kindest/node" no
nodes Nodes information to create cluster with control plan and worker. Default is AIO node.
list(object({
role = string
kubeadm_config_patches = list(string)
extra_port_mappings = object({
listen_address = string
container_port = string
host_port = string
protocol = string
})
}))
[] no

Outputs

Name Description
client_certificate Client certificate content.
client_key Client key content.
cluster_ca_certificate CA Certificate content.
cluster_name The name of cluster, Can be for kube context.
endpoint Cluster endpoint.
kubeconfig Plaintext for kubeconfig generated for this kind cluster.
kubeconfig_path Path to kubeconfig file for this kind cluster that auto generated.