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"
}

Requirements

The following requirements are needed by this module:

Providers

The following providers are used by this module:

Resources

The following resources are used by this module:

Optional Inputs

The following input variables are optional (have default values):

cluster_name

Description: The name to give to the cluster.

Type: string

Default: "kind"

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.16

= Providers

Name Version

>= 0.0.16

>= 2.23.1

= Resources

Name Type

resource

data source

= Inputs

Name Description Type Default Required

The name to give to the cluster.

string

"kind"

no

Kubernetes version to use for the KinD cluster (images available here).

string

"v1.26.0"

no

List of nodes

list(map(string))

[
  {
    "platform": "devops-stack"
  },
  {
    "platform": "devops-stack"
  },
  {
    "platform": "devops-stack"
  }
]

no

= Outputs

Name Description

Kubeconfig blocks to configure Terraform providers.

Raw .kube/config file for kubectl access.

Kind IPv4 Docker network subnet.