Can we build it?

Easier Kubernetes: Build APIs as easy as 1, 2, 3 with Kubebuilder

Sarah Schlothauer
© Shutterstock / PowerUp

Ready to make your Kubernetes experience even easier? Kubebuilder is a framework that helps developers easily build Kubernetes APIs. Let’s see what this framework has in store, and how interested developers can also contribute to its creation.

There’s no denying the popularity of Kubernetes. Even as it continues to dominate the container race, Kubernetes brings more and more goodies to the table, making it better every day. Today we welcome Kubebuilder: an SDK for building Kubernetes APIs using CRDs!

Under the hood

First thing first, what uses does Kubebuilder have and who can make the most of it?

From, “Kubebuilder is an SDK for rapidly building and publishing Kubernetes APIs in Go. It builds on top of the canonical techniques used to build the core Kubernetes APIs to provide simple abstractions that reduce boilerplate and toil. Similar to web development frameworks such as Ruby on Rails and SpringBoot, Kubebuilder increases velocity and reduces the complexity managed by developers.”

Simply put, Kubebuilder provides all the powerful libraries and tools that developers need in order to build and publish Kubernetes APIs.

Its philosophy is fairly simple. Kubebuilder wishes to provide clean library abstractions with clear and well-exampled godocs, and to never fork and modify a boilerplate.

SEE ALSO: Introducing the Operator Framework: Building Kubernetes applications just got easier

Included features

So, how does it do all of this? Let’s see what features are inside.

  • Initializing projects with a base structure including
    • Go package dependencies at canonical versions.
    • main program entry point
    • Makefile for formatting, generating, testing and building go
    • Dockerfile for building container images
  • Scaffolding APIs with
    • Resource (Model) definition
    • Controller implementation
    • Integration tests for Resource and Controller
    • CRD definition
  • Simple abstractions for implementing APIs
    • Controllers
    • Resource Schema Validation
    • Validating Webhooks
  • Artifacts for publishing APIs for installation into clusters
    • Namespace
    • CRDs
    • RBAC Roles and RoleBindings
    • Controller StatefulSet + Service
  • API reference documentation with examples
  • Provide higher level libraries on top of low level client libraries
    • Protect developers from breaking changes in low level libraries
    • Start minimal and provide progressive discovery of functionality
    • Provide sane defaults and allow users to override when they exist
  • Provide code generators to maintain common boilerplate that can’t be addressed by interfaces
    • Driven off of //+ comments
  • Provide bootstrapping commands to initialize new packages

How to start

SEE ALSO: “Kubernetes is not an afterthought”

Eager to start implementing Kubebuilder today? The getting started documentation will help you out.

First off, you will need to install dep, kustomize, and kubebuilder before begin. As always, we recommend downloading the most recent release, ensuring any code breaking changes or bug fixes are taken care of. (If you encounter any bugs, make sure to report them!)

Then, it’s time to create a new API (called Sloop) and run it locally by installing the CRD into the cluster.

The getting started guide also covers building and pushing a container image and how to create installation manifests for your API. Furthermore, The Hello World is available here.

Developed by creators from many paths, Kubernetes is a group effort. It includes big names such as Google and RedHat. As always, they are currently looking for feedback and contributions from developers. If you would like to get involved in the active development, check out the chat on Slack and see what issues exist on GitHub. Check out the contribution guidelines for more details.

Sarah Schlothauer

Sarah Schlothauer

All Posts by Sarah Schlothauer

Sarah Schlothauer is the editor for She received her Bachelor's degree from Monmouth University, West Long Branch, New Jersey. She currently lives in Frankfurt, Germany with her husband and cat where she enjoys reading, writing, and medieval reenactment. She is also the editor for Conditio Humana, an online magazine about ethics, AI, and technology.

Inline Feedbacks
View all comments