Working Offline
This guide covers how to work with KIND in an offline / airgapped environment.
You should first install kind before continuing.
Using a pre-built node image đ︎
KIND provides some pre-built images, these images contain everything necessary to create a cluster and can be used in an offline environment.
You can find available image tags on the releases page.
Please include the @sha256:
image digest from the image in the release notes.
You can pull it when you have network access, or pull it on another machine and then transfer it to the target machine.
â ~ docker pull kindest/node:v1.17.0@sha256:9512edae126da271b66b990b6fff768fbb7cd786c7d39e86bdf55906352fdf62
sha256:9512edae126da271b66b990b6fff768fbb7cd786c7d39e86bdf55906352fdf62: Pulling from kindest/node
cc5a81c29aab: Pull complete
81c62728355f: Pull complete
ed9cffdd962a: Pull complete
6a46f000fce2: Pull complete
6bd890da28be: Pull complete
0d88bd219ffe: Pull complete
af5240f230f0: Pull complete
Digest: sha256:9512edae126da271b66b990b6fff768fbb7cd786c7d39e86bdf55906352fdf62
Status: Downloaded newer image for kindest/node@sha256:9512edae126da271b66b990b6fff768fbb7cd786c7d39e86bdf55906352fdf62
docker.io/kindest/node:v1.17.0@sha256:9512edae126da271b66b990b6fff768fbb7cd786c7d39e86bdf55906352fdf62
You can save node image to a tarball.
â ~ docker save -o kind.v1.17.0.tar kindest/node:v1.17.0@sha256:9512edae126da271b66b990b6fff768fbb7cd786c7d39e86bdf55906352fdf62
# or
â ~ docker save kindest/node:v1.17.0@sha256:9512edae126da271b66b990b6fff768fbb7cd786c7d39e86bdf55906352fdf62 | gzip > kind.v1.17.0.tar.gz
When you transport image tarball to the machine,
you can load the node image by docker load
command.
â ~ docker load -i kind.v1.17.0.tar
Loaded image ID: sha256:ec6ab22d89efc045f4da4fc862f6a13c64c0670fa7656fbecdec5307380f9cb0
# or
â ~ docker load -i kind.v1.17.0.tar.gz
Loaded image ID: sha256:ec6ab22d89efc045f4da4fc862f6a13c64c0670fa7656fbecdec5307380f9cb0
And create a tag for it.
â ~ docker image tag kindest/node:v1.17.0@sha256:9512edae126da271b66b990b6fff768fbb7cd786c7d39e86bdf55906352fdf62 kindest/node:v1.17.0
â ~ docker image ls kindest/node
REPOSITORY TAG IMAGE ID CREATED SIZE
kindest/node v1.17.0 ec6ab22d89ef 3 weeks ago 1.23GB
Finally, you can create a cluster by specifying the --image
flag.
â ~ kind create cluster --image kindest/node:v1.17.0
Creating cluster "kind" ...
â Ensuring node image (kindest/node:v1.17.0) đŧ
â 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
Have a question, bug, or feature request? Let us know! https://kind.sigs.k8s.io/#community đ
Building the node image đ︎
In addition to using pre-built node image, KIND also provides the ability to build node image from Kubernetes source code.
Please note that during the image building process, you need to download many dependencies. It is recommended that you build at least once online to ensure that these dependencies are downloaded to your local. See building the node image for more detail.
The node-image in turn is built off the base image.
Prepare Kubernetes source code đ︎
You can clone Kubernetes source code.
â ~ mkdir -p $GOPATH/src/k8s.io
â ~ cd $GOPATH/src/k8s.io
â ~ git clone https://github.com/kubernetes/kubernetes
Building image đ︎
â ~ kind build node-image --image kindest/node:main $GOPATH/src/k8s.io/kubernetes
Starting to build Kubernetes
...
Image build completed.
When the image build is complete, you can create a cluster by passing the --image
flag.
â ~ kind create cluster --image kindest/node:main
Creating cluster "kind" ...
â Ensuring node image (kindest/node:main) đŧ
â 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
Have a question, bug, or feature request? Let us know! https://kind.sigs.k8s.io/#community đ
HA cluster đ︎
If you want to create a control-plane HA cluster then you need to create a config file and use this file to start the cluster.
â ~ cat << EOF | kind create cluster --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
# 3 control plane node and 1 workers
nodes:
- role: control-plane
- role: control-plane
- role: control-plane
- role: worker
EOF
Note that in an offline environment, in addition to preparing the node image, you also need to prepare HAProxy image in advance.
You can find the specific tag currently in use at loadbalancer source code.