Difficulty: Intermediate
Estimated Time: 30 minutes

Creating an Operator based on Kubebuilder

In this scenario you will experience what it's like to create and run a Kubernetes Operator that manages a custom resource. The Operator is created using the Kubebuilder tool. The custom resources will be called "At"s.

Kubebuilder was released as open source in August from 2018. Two technical staff members from Google, Phillip Wittrock and Sunil Arora, founded the project. Kubebuilder is now a Kubernetes special interest group (SIG) under Apache License 2.0.

The Operator Pattern is a very important technique to extend and build upon the basic features of Kubernetes. Operators are controllers with roles that observe and manage associated Custom Resource Definitions (CRDs). There are a variety of projects that provide tools to build Operators. Kubebuilder is one prominent technique.

This scenario stands on the shoulders of others. The at utility is found on many operating systems and it allows you to schedule a command to run at a future date. There is a project called cnat and it stands for cloud native at. There is also an outdated tutorial on Kubebuilder with cnat. Many improvements were applied to Kubebuilder which deprecated that tutorial. Recently, Ken Sipe created a updated lab inspired from at, cnat and the old tutorial. In turn, this scenario is a translation of Ken's lab onto Katacoda. You now get to enjoy the broad shoulders of open source and the cloud native community.

In this scenario you will learn how to:

  • Modify, build and test code in a Kubebuilder skeleton project
  • Create a new CRD call at through Go structs and automation
  • Define RBACs created through generation from code annotations
  • Create a controller for observing and managing the at custom resources
  • Associate Kubernetes events back to the managed resources


You now have a better understanding of how to write an Operator using the Kubebuilder. The real goal of this scenario is to show you the power of extending Kubernetes with your a custom resources and coding controllers that are dedicated to observing and managing your custom resources.

There are some other competing Operator frameworks such as the Operator-SDK, Metacontroller and KUDO. KUDO, governed by D2IQ, may be an easier way to write an Operator as it embraces a declarative form over an imperative Go-based controller. In this Katacoda course head over to the scenario for learning KUDO and hopefully you will see why it was created to make writing Operators even easier.

Lessons Learned

With these steps you have learned:

  • ✔ how to modify, build and test code in a Kubebuilder skeleton project,
  • ✔ how to create a CRD through Go structs and, automation,
  • ✔ how to define RBACs created through generation from code annotations,
  • ✔ how to create a controller for observing and managing the at custom resources,
  • ✔ how to associate Kubernetes events back to the managed resources.

Special Thank You

To Ken Sipe as he inspired this scenario from his labs found here.


For a deeper understanding of these topics and more join
Jonathan Johnson
at various conferences, symposiums, workshops, and meetups.

Software Architectures ★ Speaker ★ Workshop Hosting ★ Kubernetes & Java Specialist

Develop an Operator with Kubebuilder

Step 1 of 12

Your Kubernetes Cluster

For this scenario, Katacoda has just started a fresh Kubernetes cluster for you. Verify it's ready for your use.

kubectl version --short && \ kubectl get componentstatus && \ kubectl get nodes && \ kubectl cluster-info

The Helm package manager used for installing applications on Kubernetes is also available.

helm version --short

Kubernetes Dashboard

You can administer your cluster with the kubectl CLI tool or use the visual Kubernetes Dashboard. Use this script to access the protected Dashboard.


This tab will not be visible to users and provides only information to help authors when creating content.

Creating Katacoda Scenarios

Thanks for creating Katacoda scenarios. This tab is designed to help you as an author have quick access the information you need when creating scenarios.

Here are some useful links to get you started.

Running Katacoda Workshops

If you are planning to use Katacoda for workshops, please contact [email protected] to arrange capacity.

Debugging Scenarios

Below is the response from any background scripts run or files uploaded. This stream can aid debugging scenarios.

If you still need assistance, please contact [email protected]