

- The resource’s spec is where users express desired state. For a simple web app, common fields include:
image— the container image to runreplicas— how many copies (Pods) should run
What the operator creates for you
Behind each web app object, the controller will create and reconcile three child Kubernetes objects. These ensure the app runs reliably and is discoverable:
Starting with the API: CRDs
You begin on the API side. A CustomResourceDefinition (CRD) teaches Kubernetes that a
WebApp (or similar) is a valid API object. After installing the CRD you can create web app resources and inspect how Kubernetes accepts, stores, and validates them.
Scaffolding with Kubebuilder
We use Kubebuilder to scaffold the operator project. Kubebuilder generates the project structure, boilerplate files, and controller entry points so you don’t start from an empty folder. You will examine the generated code and then add your reconcile logic.
Kubebuilder gives you a solid starting point: CRD manifests,
api/ types, and controller skeletons. Use the scaffold to focus on reconcile logic rather than plumbing.- Reads the web app resource (desired state)
- Compares it to the actual cluster state
- Creates or updates the Deployment, Service, and ConfigMap so the cluster matches the spec
- Status and events — surface what the operator has done and why
- Validation — reject invalid web app specs before they’re persisted
- Finalizers — let the controller clean up child resources before deletion completes
- Packaging — build the controller into a container image that runs inside the cluster

Real-world operators
Near the end of the course you’ll switch into consumer mode and inspect established operators to see how they solve similar problems in production, for example:
cert-manager— certificate management for Kubernetes (docs)- Prometheus Operator — monitoring and observability patterns (prometheus-operator.dev)