(DinD(KinD()))/SSH

Need to deploy a quick Kubernetes cluster? Need to expose it on the Wide Area Network? Got a public facing SSH server?

How about exposing a Kubernetes in Docker cluster deployed locally in a Docker in Docker container over SSH.

Setup

Run the kind container: docker run --rm -d --name kind --privileged --network host docker.pkg.github.com/lazybit-ch/kind/kind:v0.7.0

Create the kind cluster: docker exec -it kind kind create cluster

Forward traffic to our local kind cluster through our public facing SSH server in the background: ssh -N -f -R 32768:localhost:32768 example.com

Note: you may need to enable GatewayPorts in the remote servers sshd_config.

Update the kind containers /root/.kube/config to point to your public server: docker exec -it kind sed -i -e 's/127.0.0.1/example.com/g' /root/.kube/config

Test the connection: docker exec -it kind kubectl get pod --all-namespaces --insecure-skip-tls-verify -o jsonpath="{.items[*].spec.containers[*].name}"