explaingit

kubernetes-sigs/kubebuilder

9,137GoAudience · developerComplexity · 4/5Setup · hard

TLDR

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.

Mindmap

mindmap
  root((kubebuilder))
    What it does
      Custom resource types
      Controller scaffolding
      Boilerplate generation
    Tech
      Go language
      Kubernetes API
      Makefile build
    Use Cases
      Kubernetes operators
      Custom resources
      Platform extensions
    Setup
      CLI project init
      Kubernetes cluster
      Go environment
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Define a custom Kubernetes resource type with its own fields and have Kubernetes track and manage it like a built-in object.

USE CASE 2

Write a controller that watches for changes to your custom resources and automatically reconciles the cluster to the desired state.

USE CASE 3

Generate a ready-to-build operator project with Makefile, dependency pinning, and test scaffolding in one CLI command.

USE CASE 4

Build a reusable Kubernetes operator that other tools in the ecosystem can depend on as a shared foundation.

Tech stack

GoKubernetesMake

Getting it running

Difficulty · hard Time to first run · 1h+

Requires a running Kubernetes cluster and a Go development environment to test the generated controller.

In plain English

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.

Copy-paste prompts

Prompt 1
Bootstrap a new Kubebuilder project in Go for a custom resource called DatabaseCluster with fields for replicas and storageSize. Show me the kubebuilder CLI commands and the resulting directory structure.
Prompt 2
Walk me through writing the Reconcile function for a Kubebuilder controller that watches a custom resource and creates a Deployment when one doesn't exist.
Prompt 3
How do I run Kubebuilder's generated tests locally against a real Kubernetes cluster using the Makefile targets it creates?
Prompt 4
Show me how to add a status subresource to a Kubebuilder CRD so the controller can report whether the resource is Ready or Degraded.
Prompt 5
I want to add a webhook to my Kubebuilder operator that validates fields before a custom resource is created. Walk me through the scaffolding and validation logic.
Open on GitHub → Explain another repo

← kubernetes-sigs on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.