logo

BuildKit CLI for kubectl: A New Way to Build Container Images

Authors:   Daniel Hiltgen, Patrick Devine


Summary

The presentation discusses the use of Kubernetes native RBAC for access control and the benefits of using a privileged builder pod for development clusters. The Build Kit project is introduced as a powerful toolkit for converting source to build artifacts.
  • Kubernetes native RBAC is used for access control in builder pods
  • Privileged builder pods are efficient for development clusters but not recommended for production clusters
  • Build Kit project is a powerful toolkit for converting source to build artifacts
  • Build Kit is compatible with the latest Dockerfile features and can run build steps in parallel for faster builds
  • Fast developer interloop can be optimized using local image builds and deployment strategies
The presenter demonstrates a fast developer interloop using a simple Dockerfile and deployment strategy set to recreate. The image pull policy is set to never to ensure the use of the locally built image. The builder pod is automatically detected and uses Containerd as the runtime after failing to use Docker. The image is built and tagged with the specified tag, and is immediately available for use on all nodes in the cluster.

Abstract

The Dockerfile is a tremendously popular format used to build container images. Various projects exist that focus on CI for Dockerfiles inside a kubernetes cluster, but what about developers and their inner loop? In this talk we’ll introduce a new CLI plugin optimized for developers which implements a familiar UX for building container images. It utilizes a powerful open source component called BuildKit to build Dockerfiles into images directly inside your Kubernetes cluster. When you build images, they are immediately available on the cluster for testing without requiring pushing to an external registry, providing an extremely efficient inner loop for development. The builder supports the two most popular container runtimes–containerd and dockerd–and will auto-detect the correct runtime in most cases. kubectl build -t myimage:latest -f Dockerfile .

Materials:

Tags: