Skip to content

How to create builder in k8s? #685

Answered by morlay
morlay asked this question in Q&A
Discussion options

You must be logged in to vote

Here are two modes to create builder in k8s

With QEMU

$ KUBECONFIG=${KUBECONFIG} \
    docker buildx create \
        --name=builder \
        --platform=linux/amd64,linux/arm64 \
        --driver=kubernetes \
        --driver-opt=namespace=buildkit,qemu.install=true

Known Issues

QEMU only work well for executing, but for compiling, it will be obviously slow and may be throw segmentation fault.

In the mode, if still want to compile binaries in docker.
please use FROM --platform=${BUILDPLATFORM} to disable QEUM for compiling stage.

Example for golang:

FROM --platform=${BUILDPLATFORM} golang:1.6 as builder

ARG TARGETARCH
RUN GOARCH=${TARGETARCH} go build -o /bin/app-linux-${TARGETARCH} ./p…

Replies: 1 comment

Comment options

morlay
Jul 21, 2021
Collaborator Author

You must be logged in to vote
0 replies
Answer selected by morlay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant