Skip to content

Instantly share code, notes, and snippets.

@jpbetz
Last active August 22, 2023 17:27
Show Gist options
  • Save jpbetz/29f34bb5732744699d305646327909f3 to your computer and use it in GitHub Desktop.
Save jpbetz/29f34bb5732744699d305646327909f3 to your computer and use it in GitHub Desktop.
How emulate other architectures (ppc64le, arm64) to test Kubernetes code

First, install podman and buildah. These tools support running containers build for other architectures like arm64 and ppc64le.

Next, create a Dockerfile, e.g.:

FROM ppc64le/golang:1.20.7-alpine
ADD kubernetes /kubernetes

Note that this dockerfile is for ppc64le, so can't be run directly with docker on an amd64 linux machine.

But it can be run using buldah:

buildah bud -f Dockerfile -t cross-arch-example .
container=$(buildah from cross-arch-example)

# use the container for whatever you need, e.g. to run a test:
buildah run $container -- sh -c 'cd /kubernetes/staging/src/k8s.io/apiextensions-apiserver && go test -v -timeout 30s -run ^TestCostEstimation/extended_library_replace$ ./pkg/apiserver/schema/cel'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment