Building Kind - linux-on-ibm-z/docs GitHub Wiki

Building Kind

The instructions provided below specify the steps to build Kind version 0.33.0 on Linux on IBM Z for the following distributions:

  • RHEL (8.10, 9.6, 9.7, 9.8, 10.0, 10.1, 10.2)
  • SLES (15 SP7, 16)
  • Ubuntu (22.04, 24.04)

General Notes:

  • When following the steps below please use a standard permission user unless otherwise specified.

  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.

Prerequisites

  • Docker packages can be installed by following the instructions here.

1. Build using script

If you want to build Kind using manual steps, go to STEP 2.

Use the following commands to build Kind using the build script. Please make sure you have wget installed.

wget https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Kind/0.33.0/build_kind.sh

# Build Kind
bash build_kind.sh   [Provide -t option for executing build with tests]

If the build and tests complete successfully, go to STEP 5. In case of error, check logs at <source_root>/logs/ for more details or go to STEP 2 to follow manual build steps.

2. Install Dependencies

export SOURCE_ROOT=/<source_root>/
export PATCH_URL="https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Kind/0.33.0/patch"

2.1. Install Basic Dependencies

  • RHEL (8.10, 9.6, 9.7, 9.8, 10.0, 10.1, 10.2)

    sudo yum install -y curl git wget make tar gcc glibc.s390x make which patch iproute-devel
    export CC=gcc
    
  • SLES (15 SP7, 16)

    sudo zypper install -y curl git make wget tar gcc glibc-devel-static make which patch iproute2
    export CC=gcc
    
  • Ubuntu (22.04, 24.04)

    sudo apt-get update
    sudo apt-get install -y ca-certificates patch git make curl tar gcc wget iproute2
    export CC=gcc
    

3. Build Kind binary and images

3.1. Download Kind source code

cd $SOURCE_ROOT
if [ -d "$SOURCE_ROOT/kind" ]; then
  sudo rm -rf "$SOURCE_ROOT/kind"
fi
git clone -b v0.33.0 https://github.com/kubernetes-sigs/kind.git

3.2. Apply patch and build Kind binaries

cd $SOURCE_ROOT/kind
curl -sSL $PATCH_URL/kind.patch | git apply --ignore-whitespace -
# RHEL 8.10 only: allow cgroup v1 and pre-create the kubelet kubepods cgroup path.
if . /etc/os-release && [ "$ID" = "rhel" ] && [ "$VERSION_ID" = "8.10" ]; then
  sed -i '/failSwapOn: false/a failCgroupV1: false' pkg/cluster/internal/kubeadm/config.go
  cat >> images/base/files/etc/systemd/system/kubelet.service.d/11-kind.conf <<'EOF_RHEL810_CGROUP_FIX'
ExecStartPre=/bin/sh -euc "if [ ! -f /sys/fs/cgroup/cgroup.controllers ]; then mkdir -p /sys/fs/cgroup/systemd/kubelet /sys/fs/cgroup/systemd/kubelet.slice/kubelet-kubepods.slice; fi"
EOF_RHEL810_CGROUP_FIX
fi
make build
export PATH=${SOURCE_ROOT}/kind/bin:$PATH
kind version

3.3. Build Kind images

cd $SOURCE_ROOT/kind
make -C images/base quick REGISTRY=kindest TAG=v20260601-995e8fa5
make -C images/kindnetd REGISTRY=kindest TAG=v20260528-9350166c quick
make -C images/local-path-provisioner REGISTRY=kindest TAG=v20260521-9fb22683 quick
make -C images/local-path-helper REGISTRY=kindest TAG=v20260131-7181c60a quick

4. Testing (Optional)

cd $SOURCE_ROOT/kind
make test
make unit
make integration

5. Verification

5.1. Build cross image

Note: REGISTRY is set to local by default for local builds; replace local with your preferred registry if you want to push images to a specific registry.

cd $SOURCE_ROOT
git clone -b v0.19.0 https://github.com/kubernetes/release.git
cd release
curl -s $PATCH_URL/release.patch | git apply --ignore-whitespace -
export REGISTRY=local
docker buildx inspect
cd images/build/cross/
TARGETPLATFORM=s390x make container

5.2. Build Node image

cd $SOURCE_ROOT
git clone -b v1.36.1 https://github.com/kubernetes/kubernetes.git
cd kubernetes
sed -i 's,v1.36.0-go1.26.2-bullseye.0,v1.36.0-go1.26.2-trixie.0,g' build/build-image/cross/VERSION
docker buildx use default
KUBE_CROSS_IMAGE=${REGISTRY}/kube-cross-s390x kind build node-image
docker tag kindest/node:latest ${REGISTRY}/kindest/node:latest

5.3. Create K8s cluster

kind create cluster --image=${REGISTRY}/kindest/node:latest

5.4. Load Kind images

kind load docker-image kindest/kindnetd:v20260528-9350166c
kind load docker-image kindest/local-path-provisioner:v20260521-9fb22683
kind load docker-image kindest/local-path-helper:v20260131-7181c60a

Following example shows logs for a successful cluster creation:

Creating cluster "kind" ...
 ✓ Ensuring node image (local/kindest/node:latest) đŸ–ŧ
 ✓ 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

Thanks for using kind! 😊

Following pods are expected after successful cluster creation:

NAMESPACE            NAME                                         READY   STATUS    RESTARTS   AGE
kube-system          coredns-589f44dc88-9ks8z                     1/1     Running   0          5m12s
kube-system          coredns-589f44dc88-wq2ww                     1/1     Running   0          5m12s
kube-system          etcd-kind-control-plane                      1/1     Running   0          5m20s
kube-system          kindnet-75gxw                                1/1     Running   0          5m12s
kube-system          kube-apiserver-kind-control-plane            1/1     Running   0          5m19s
kube-system          kube-controller-manager-kind-control-plane   1/1     Running   0          5m17s
kube-system          kube-proxy-zn67v                             1/1     Running   0          5m12s
kube-system          kube-scheduler-kind-control-plane            1/1     Running   0          5m21s
local-path-storage   local-path-provisioner-855c7b7774-mg4qv      1/1     Running   0          5m12s

References: