Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alexchiri/5791c93eaf31f53ad865336fa09527ba to your computer and use it in GitHub Desktop.
Save alexchiri/5791c93eaf31f53ad865336fa09527ba to your computer and use it in GitHub Desktop.

Create a multi-node kind cluster and with a different kubernetes version than default

The instructions in this tutorial are not WSL2 specific, but if you would like to see how to get started with kind in WSL2 (and afterwards follow along with this tutorial), do have a look at this video.

How to create a local multi-node Kubernetes cluster with kind

In order to create a multi-node cluster with kind, we need to create a configuration file. Let's say we want to create a 3 node cluster, 1 control-plane and 2 workers, we would then create the following configuration file (you can save it as kind-config.yaml):

kind: Cluster
apiVersion: kind.sigs.k8s.io/v1alpha3
nodes:
- role: control-plane
- role: worker
- role: worker

To create a cluster using this configuration file we need to run kind create cluster --name kind-cluster --config kind-config.yaml. The --config option takes a path to the configuration file, so make sure to adjust it accordingly to correctly point to your kind config file.

How to specify a different Kubernetes version for the cluster nodes

First, we need to figure out what versions are available. Since kind uses docker images for each node, let's go to Docker Hub and see what is available: https://hub.docker.com/r/kindest/node

If for example, we want to create a kind cluster that uses Kubernetes 1.17.5 using the kind config above, we would run kind create cluster --image "kindest/node:v1.17.5" --name kind-cluster --config kind-config.yaml

@NekoTashi
Copy link

cat <<EOF | kind create cluster --config=-
kind: Cluster
apiVersion: kind.sigs.k8s.io/v1alpha3
nodes:
- role: control-plane
- role: worker
- role: worker
EOF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment