

Starter controller code is already wired to the manager. Before adding your custom APIs and reconcile logic, it helps to compare Kubebuilder with the Operator SDK: both leverage controller-runtime but provide different developer experiences and tooling. For this course, Kubebuilder is the primary scaffold tool.

- Verify your toolchain and install Kubebuilder.
- Initialize a new project and create an API for the WebApp kind.
Ensure
go and kubebuilder are in your PATH. The --domain you pass to kubebuilder init becomes the DNS domain for your CRD API group (for example: apps.kodekloud.com/v1).api/v1/webapp_types.goβ the Go structs that define the WebApp spec and status.controllers/webapp_controller.goβ the Reconciler that runs when WebApp resources change.main.goβ wires the manager, controllers, and sets up leader election, metrics, etc.Makefileβ contains common targets:makebuild,make run,make docker-build,make install(CRDs),make deploy.
Reconcile where you add the operator logic.

controller-gen) to generate CRD manifests and RBAC rules from annotated comments (markers) in your Go types and controller code. Markers are straightforward and drive automation.
Example RBAC marker:
config/rbac/ and CRD YAML in config/crd/bases/ after you run the generator targets (for example: make generate and make manifests, depending on your Makefile).
Always verify generated RBAC rules and CRD group/version names before applying to a cluster. Incorrect RBAC or API group names can prevent your controller from watching or acting on resources.
kubebuilder create api repeatedly to add new groups/versions/kinds; the scaffold keeps APIs and controllers organized under api/ and controllers/, and PROJECT records your layout.
Wrap-up
After completing this section you will have:
- A compiling operator project.
- Generated CRD YAML to install into a cluster.
- An empty
Reconcilemethod ready for your business logic. - An understanding of how markers drive CRD and RBAC generation and where to add additional APIs.