1 minute read

When working with Kubernetes, it is convenient to spin up a local cluster for development purposes. There are a variety of solutions for doing this: Minikube, KinD, micro8s, etc. Rancher provide a solution called k3s and a wrapper called k3d.

k3d is a lightweight wrapper to run k3s (Rancher Lab’s minimal Kubernetes distribution) in docker.

k3d makes it very easy to create single and multi-node k3s clusters in docker, e.g. for local development on Kubernetes.

When using wrappers to work with solutions, I find that typically there are common subset that I use repeatedly. By providing a wrapper around the wrapper :-) I can minimise the common tasks that I’ll do with the cluster.

Kubernetes Development Environment (kde) is an attempt at a wrapper wrapper. It is a bash script with a small set of flags that spins up a k3s cluster, configures a registry and starts a few backing services to interact with.

kde.sh - Kubernetes Developer Environment

    Usage: kde.sh -h
           kde.sh -c -r -b

      -i    Install dependencies (k3d, helm, kubectl)
      -h    Show this help message
      -v    Show Version
      -c    Create a Cluster
      -a    Create a Cluster with Ambassador (instead of Traefik)
      -d    Delete a Cluster
      -s    Cluster Status
      -r    Create Registry
      -b    Install 3rd-party Backing Services (postgres, nats, ...)