devops-stack-module-cluster-kind
A DevOps Stack module to deploy a KinD cluster based on Docker.
This cluster module is mainly used to deploy a single-node Kubernetes cluster used for testing and development as well as for onboarding new users of the DevOps Stack.
Because KinD is nothing more than a Kubernetes cluster running inside a container, it is required that you have Docker up and running on your machine (the documentation to install Docker is available here here).
Usage
This module can be declared by adding the following block on your Terraform configuration:
module "kind" {
source = "git::https://github.com/camptocamp/devops-stack-module-kind.git?ref=<RELEASE>"
cluster_name = local.cluster_name
}
You can configure the version of Kubernetes by passing the variable kubernetes_version
. This variable is nothing more than the tag of the image that is to be deployed. You can see the usable versions in Docker Hub.
module "kind" {
source = "git::https://github.com/camptocamp/devops-stack-module-kind.git?ref=<RELEASE>"
cluster_name = local.cluster_name
kubernetes_version = "1.25.3"
}
It is also possible to configure the ports that are mapped between the KinD container and your machine. This is needed in order to access services that you deploy inside the cluster. By default, this module already maps the ports needed for HTTP and HTTPS traffic.
module "kind" {
source = "git::https://github.com/camptocamp/devops-stack-module-kind.git?ref=<RELEASE>"
cluster_name = local.cluster_name
extra_port_mappings = ["tcp/22", "udp/53"]
}
A test deployment of the DevOps Stack is available here. |
Technical Reference
Dependencies
Obviously, since this module deploys the cluster, it does not depend on any other module of the DevOps Stack. The only thing you’ll probably want to configure are some locals
with some common variables used on all the modules:
locals {
cluster_name = "gh-v1-cluster"
cluster_issuer = "ca-issuer"
argocd_namespace = "argocd"
}
Resources
The following resources are used by this module:
-
kind_cluster.cluster (resource)
-
docker_network.kind (data source)
Optional Inputs
The following input variables are optional (have default values):
kubernetes_version
Description: Kubernetes version to use for the KinD cluster (images available here).
Type: string
Default: "v1.26.0"
nodes
Description: List of nodes
Type: list(map(string))
Default:
[
{
"platform": "devops-stack"
},
{
"platform": "devops-stack"
},
{
"platform": "devops-stack"
}
]
Outputs
The following outputs are exported:
parsed_kubeconfig
Description: Kubeconfig blocks to configure Terraform providers.
raw_kubeconfig
Description: Raw .kube/config
file for kubectl
access.
kind_subnet
Description: Kind IPv4 Docker network subnet.
Reference in table format
Show tables
= Requirements
Name | Version |
---|---|
>= 2.23.1 |
|
0.0.17 |
= Providers
Name | Version |
---|---|
0.0.17 |
|
>= 2.23.1 |
= Resources
Name | Type |
---|---|
resource |
|
data source |
= Inputs
Name | Description | Type | Default | Required |
---|---|---|---|---|
The name to give to the cluster. |
|
|
no |
|
Kubernetes version to use for the KinD cluster (images available here). |
|
|
no |
|
List of nodes |
|
|
no |
= Outputs
Name | Description |
---|---|
Kubeconfig blocks to configure Terraform providers. |
|
Raw |
|
Kind IPv4 Docker network subnet. |