Dockerized Kubernetes
This image, based on kind's node image contains all the requirements to start a Kubernetes single-node cluster with a preloaded "busybox" image. It is useful for bootstrapping a dockerized Kubernetes test cluster in environments that are isolated or where the kind CLI is not available.
To bootstrap the cluster, run the following:
docker run --name=${NAME}-control-plane --hostname=${NAME}-control-plane --privileged --security-opt seccomp=unconfined --security-opt apparmor=unconfined --tmpfs /tmp --tmpfs /run -p 127.0.0.1:${PORT}:6443 --tty --label io.x-k8s.kind.role="control-plane" --label io.x-k8s.kind.cluster="${NAME}" --detach=true -t guyrotem/kubernetes:latest
replacing ${NAME} with a name of your choice, ${PORT} with the port on your host where you wish API server to be available.
When the container is running, execute the following commands:
init-kube.sh, create-cni.sh
e.g.: docker exec -it ${NAME}-control-plane init-kube.sh, docker exec -it ${NAME}-control-plane create-cni.sh.
Finally, copy kube-config credentials from the container to your host:
docker exec -it ${NAME}-control-plane cat /etc/kubernetes/admin.conf | sed 's/172.17.0.2:6443/127.0.0.1:${PORT}/g' > ${PATH_TO_KUBECONFIG_FILE}
replacing ${NAME} and ${PORT} with your selected values, in addition to ${PATH_TO_KUBECONFIG_FILE}.
Now you can run kubectl commands against this cluster by running:
kubectl --kubeconfig=${PATH_TO_KUBECONFIG_FILE} <your kubectl command> e.g.: kubectl --kubeconfig=/docs/kind.conf get pods --all-namespaces
This cluster can only load containers with the "busybox" image. to load containers of additional image, save and copy an image tar to the container, then run:
ctr --namespace=k8s.io images import ${PATH_IN_CONTAINER_TO_IMAGE_TAR} (inside the container)
Content type
Image
Digest
Size
440.1 MB
Last updated
over 6 years ago
docker pull guyrotem/kubernetes