Lightweight k3s Kubernetes inside a Docker-in-Docker container.
This is a fork adapted to be used by
Gnomock: it supports hostname/port
configuration and exposes kubeconfig
file over HTTP for easier programmatic
access.
docker run --rm --name k3s --privileged \
-p 28888:80 \
-p 48443:48443 \
-e K3S_API_HOST=localhost \
-e K3S_API_PORT=48443 \
orlangure/k3s
curl localhost:28888/kubeconfig > kubeconfig
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.