Lightweight k3s Kubernetes inside a Docker-in-Docker container
docker network create k3s
docker run -d --privileged --name k3s --hostname k3s --network k3s unboundedsystems/k3s-dind
docker exec k3s cat /kubeconfig > ./k3sconfig
export KUBECONFIG=./k3sconfig
kubectl get nodes
NAME STATUS ROLES AGE VERSION
k3s Ready <none> 1m v1.14.1-k3s.4
kubectl create ...
k3s-dind allows you to quickly create a lightweight local Kubernetes cluster, self-contained inside a single Docker-in-Docker (DinD) container.
k3s-dind is awesome for:
- Quickly running automated unit tests in Kubernetes
- Running your containerized app locally for easier debugging
- Testing out automation or changes to a Kubernetes cluster
- Ensuring you're starting with a fresh cluster every time
- Doing all that stuff in only 512MB of RAM!
Nope! The awesome folks over at Rancher Labs did all the hard work of creating k3s. We just packaged it into a Docker-in-Docker container.