Some extra commands to partially build kubernetes

Sometimes we are just testing small changes in a command or service and we don’t need to build the whole kubernetes universe as we did in the previous post, so the alternative is to build the binary we are playing with. For that, we just need to specify it with the environment variable WHAT, and we have two ways of doing it: compile it in our own environment with make WHAT=cmd/kubelet or building it using the docker images provided by the k8s community. For this last case, we simply need to append any command we want to run with build/




if [[ ${KUBE_RUN_COPY_OUTPUT} =~ ^[yY]$ ]]; then
  kube::log::status "Output from this container will be rsynced out upon completion. Set KUBE_RUN_COPY_OUTPUT=n to disable."
  kube::log::status "Output from this container will NOT be rsynced out upon completion. Set KUBE_RUN_COPY_OUTPUT=y to enable."

kube::build::run_build_command "$@"

if [[ ${KUBE_RUN_COPY_OUTPUT} =~ ^[yY]$ ]]; then

This script is really simple to follow and very similar to the build/ we talked about in the previous post.  verify_prereqs and build_image will check that we have a running docker and will build the docker image (using build/build-image/Dockerfile) Next it will run kube::build::run_build_command with the commands we want to execute inside the docker image, and finally copy the results to the _output folder.

Simple, clean and easy to follow. We will use this build/ not just for building binaries, but also for anything that we want to run inside the docker environment like testing and verifying. Again, using the WHAT environment variable, we can reduce the scope of the command to just the part of the project we are working with.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s