kind

kind runs Kubernetes in Docker containers, and maybe more in the future.

Multi-node setup

I am using the following configuration to be able to run a kind cluster on one of my local server and target it from my laptop.

Note

wakasu.home IP is 192.168.1.77

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
  apiServerAddress: "192.168.1.77"
  apiServerPort: 8443
containerdConfigPatches:
- |-
  [plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:5000"]
    endpoint = ["http://sakhalin.home:5000"]
nodes:
- role: control-plane
  kubeadmConfigPatches:
  - |
    kind: InitConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        node-labels: "ingress-ready=true"
  extraPortMappings:
  - containerPort: 80
    hostPort: 80
    protocol: TCP
  - containerPort: 443
    hostPort: 443
    protocol: TCP
- role: worker
- role: worker

Then, to provision this and get the configuration file, it’s a matter of 2 commands.

ssh wakasu.home kind create cluster --config ~/var/kind/wakasu.kind.yaml --name wakasu
ssh wakasu.home kind get kubeconfig --name wakasu > ~/.kube/config.wakasu.kind
cat <<EOF | kubectl --kubeconfig=$HOME/.kube/config.wakasu.kind apply -f -
apiVersion: v1
kind: ConfigMap
metadata:
  name: local-registry-hosting
  namespace: kube-public
data:
  localRegistryHosting.v1: |
    host: "localhost:5000"
    help: "https://kind.sigs.k8s.io/docs/user/local-registry/"
EOF