kubebuilder
Kubebuilder - SDK for building Kubernetes APIs using CRDs
A toolkit for Go developers to extend Kubernetes with custom resource types and the controller logic that manages them, generating all the boilerplate setup code so you can focus on your own business logic.
Kubernetes is a system for running many software services at once across a cluster of computers, managing how those services start, stop, and scale. Kubebuilder is a developer tool that helps programmers extend Kubernetes by adding their own custom resource types and the logic that manages them.
By default, Kubernetes understands built-in concepts like Deployments and Pods. Kubebuilder lets you define entirely new concepts, called Custom Resource Definitions (CRDs), that Kubernetes can then track and manage just like the built-in ones. Alongside each new resource type you define a controller, which is a piece of code that watches for changes to those resources and takes action to reconcile the current state of the system with the desired state you specified.
Building this kind of extension from scratch involves a lot of repeated setup code. Kubebuilder reduces that burden by generating the boilerplate for you and providing libraries that handle the low-level communication with Kubernetes. The workflow is to create a project with the Kubebuilder command-line tool, define your resource types with their fields, write the reconcile logic in the generated controller files, and then run the whole thing against a Kubernetes cluster for testing.
The framework is written in Go and targets Go developers. It is an official project under the Kubernetes project's own GitHub organization. Other tools in the Kubernetes ecosystem, such as Operator SDK, are themselves built on top of Kubebuilder's libraries, treating it as a shared foundation rather than a standalone tool.
Kubebuilder supports macOS and Linux. Projects it generates include a Makefile and a dependency file so that the exact tested tool versions are recorded and reproducible. Documentation is available in a dedicated online book at book.kubebuilder.io, and the team maintains a Slack channel for questions and discussion.
Where it fits
- Define a custom Kubernetes resource type with its own fields and have Kubernetes track and manage it like a built-in object.
- Write a controller that watches for changes to your custom resources and automatically reconciles the cluster to the desired state.
- Generate a ready-to-build operator project with Makefile, dependency pinning, and test scaffolding in one CLI command.
- Build a reusable Kubernetes operator that other tools in the ecosystem can depend on as a shared foundation.