Remote builders

BuildKit and Kubernetes

BuildKit can be used as a build service in Kubernetes


BuildKit understands the schema kube-pod://


Load balancing works


buildx comes with options to deploy BuildKit based pods

Demo: BuildKit and Kubernetes 110_ecosystem/buildkit/k8s

Create cluster:

kind create cluster

Run BuildKit daemon:

kubectl apply -f pod.rootless.yaml

Wait for pod to deploy:

watch kubectl get pods

Run build:

export BUILDKIT_HOST=kube-pod://buildkitd
buildctl build \
    --frontend=dockerfile.v0 \
    --local context=. \
    --local dockerfile=.

Demo: Managing BuildKit using buildx 110_ecosystem/buildkit/k8s

Configure buildx to use Kubernetes:

docker buildx create \
    --name k8s \
    --driver kubernetes \
    --driver-opt replicas=2 \
    --driver-opt rootless=true \
    --driver-opt loadbalance=random \

Deploy builder instances in Kubernetes:

docker buildx inspect k8s --bootstrap

Build using Kubernetes:

docker buildx build .

Demo: Making buildxthe default builder

docker buildx install

uninstall to revert

Must push during build:

docker build --tag X --push .

docker push and docker tag do not work

Similar but not identical DX