Kaniko Image Builder

Building container images with Kaniko.

The Kaniko image builder is an image builder flavor provided by the ZenML kaniko integration that uses Kaniko to build container images.

When to use it

You should use the Kaniko image builder if:

you're unable to install or use Docker on your client machine.

you're familiar with/already using Kubernetes.

How to deploy it

In order to use the Kaniko image builder, you need a deployed Kubernetes cluster.

How to use it

To use the Kaniko image builder, we need:

The ZenML kaniko integration installed. If you haven't done so, runCopyzenml integration install kaniko

kubectl installed.

A remote container registry as part of your stack.

By default, the Kaniko image builder transfers the build context using the Kubernetes API. If you instead want to transfer the build context by storing it in the artifact store, you need to register it with the store_context_in_artifact_store attribute set to True. In this case, you also need a remote artifact store as part of your stack.

Optionally, you can change the timeout (in seconds) until the Kaniko pod is running in the orchestrator using the pod_running_timeout attribute.

We can then register the image builder and use it in our active stack:

zenml image-builder register <NAME> \

--flavor=kaniko \

--kubernetes_context=<KUBERNETES_CONTEXT>

[ --pod_running_timeout=<POD_RUNNING_TIMEOUT_IN_SECONDS> ]

# Register and activate a stack with the new image builder

zenml stack register <STACK_NAME> -i <NAME> ... --set

For more information and a full list of configurable attributes of the Kaniko image builder, check out the SDK Docs .

Authentication for the container registry and artifact store

The Kaniko image builder will create a Kubernetes pod that is running the build. This build pod needs to be able to pull from/push to certain container registries, and depending on the stack component configuration also needs to be able to read from the artifact store: