Kind - Kubernetes in Docker
Work in progress…
From the documentation, “kind runs a local Kubernetes cluster by using Docker containers as ‘nodes’. kind uses the node-image to run Kubernetes artifacts, such as kubeadm or kubelet. The node-image in turn is built off the base-image, which installs all the dependencies needed for Docker and Kubernetes to run in a container.”
The release notes for the new version of kind say that “v0.6.0 brings major internal rework and some important breaking changes that we hope will make kind easier to use.”
Let's find out.
Kind Installation
Download and use the latest version from the kind releases page. For example, starting from ubuntu with docker installed:
$ curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.6.0/kind-linux-amd64
$ chmod +x ./kind
$ ./kind create cluster
Creating cluster "kind" ...
✓ Ensuring node image (kindest/node:v1.16.3) 🖼
✓ Preparing nodes 📦
✓ Writing configuration 📜
✓ Starting control-plane 🕹️
✓ Installing CNI 🔌
✓ Installing StorageClass 💾
Set kubectl context to "kind-kind"
You can now use your cluster with:
kubectl cluster-info --context kind-kind
And the local cluster is ready to use, having downloaded the following image:
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
kindest/node v1.16.3 066d19ae6707 2 weeks ago 1.22GB
As the name “kubernetes in docker” suggests, the nodes run as local docker containers. In that way it's similar to minikube's –vm-driver=none option that runs the Kubernetes components on the host and not in a VM
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a510f4f640f2 kindest/node:v1.16.3 "/usr/local/bin/entr…" 8 minutes ago Up 8 minutes 127.0.0.1:36341->6443/tcp kind-control-plane
Using Kind
Unlike microk8s, kind (by design) doesn't include kubectl, and without it, the cluster won't be doing much. Install kubectl via your preferred method. Perhaps:
$ sudo snap install kubectl --classic
kubectl 1.16.3 from Canonical✓ installed
Now you can see what's been created for you:
$ kubectl get all --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system pod/coredns-5644d7b6d9-2bb5r 1/1 Running 0 39s
kube-system pod/coredns-5644d7b6d9-np2kn 1/1 Running 0 39s
kube-system pod/kindnet-jvhxk 1/1 Running 0 39s
kube-system pod/kube-proxy-8znjp 1/1 Running 0 39s
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 55s
kube-system service/kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP,9153/TCP 53s
NAMESPACE NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
kube-system daemonset.apps/kindnet 1 1 1 1 1 <none> 52s
kube-system daemonset.apps/kube-proxy 1 1 1 1 1 beta.kubernetes.io/os=linux 53s
NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE
kube-system deployment.apps/coredns 2/2 2 2 53s
NAMESPACE NAME DESIRED CURRENT READY AGE
kube-system replicaset.apps/coredns-5644d7b6d9 2 2 2 39s
And from there you can use the local cluster any way you wish.
kubectl apply -f https://example.com/random_code_from_the_internet.yaml
I'll add a nice minimal example here soon - once I find one. I don't want to push node images to your machine.
The Only Failing
Calling the tool kind
makes it immune to googling. The Go language almost resolves that problem by
masquerading as golang. I guess that by the time kind
makes it into central packages it may be going by a
different name. Hopefully kindergarten
.
So there's probably no future for man kind
.
⁂