Example: FlightTicket CR
Example FlightTicket manifest:CRDs don’t automatically display a STATUS column in
kubectl get output. Controllers usually populate fields under .status. Inspect status with:
kubectl get flightticket my-flight-ticket -o yaml
or add custom printer columns in the CRD to show status in kubectl get.What is a controller?
A controller is a process (or set of processes) that runs a reconcile loop: it watches the Kubernetes API for changes to specific objects and reacts to those events. For FlightTicket objects, a controller might:- Call the external Flight Booking API when a new ticket is requested
- Update the resource’s
.statuswith booking state (confirmed, failed, pending) - Retry operations on transient errors
- Clean up resources when tickets are canceled
Why Go and client-go?
Using the Go client libraries (for example,k8s.io/client-go) gives you well-tested building blocks:
- Shared Informers: efficient event delivery and local caching
- Workqueues: rate-limited queues with retries
- Listers: fast reads from the local cache
Starting point — sample-controller
A widely used example project is the kubernetes/sample-controller repository. Typical workflow:- Clone the repository.
- Modify the controller implementation (e.g.,
controller.go) to add your domain logic (call the Flight Booking API when FlightTicket objects are created/updated). - Build the controller binary.
- Run it locally using your kubeconfig or build a container image and deploy it inside the cluster.

Key controller components (quick reference)
Tip: use kubebuilder or operator-framework tooling to scaffold scaffolding, CRD + controller wiring, and RBAC boilerplate quickly.
Packaging and deployment
When your controller works, package it as a container image and deploy it to the cluster (commonly as a Deployment). Running controllers inside the cluster simplifies authentication (in-cluster config) and benefits from Kubernetes’ scheduling and lifecycle management.Run controllers inside the cluster as a Deployment or DaemonSet (depending on your needs). This simplifies authentication (in-cluster config) and provides high availability and lifecycle management.
Exam note
Implementing controllers requires development work and is usually beyond the scope of basic Kubernetes administration exams. Exams commonly test:- Creating and using CustomResourceDefinitions (CRDs)
- Inspecting resources and their
.status - Understanding controller behavior at a high level (CRD → controller watches resources → controller acts → status updated)
Links and references
- Custom Resources (CRDs) — Kubernetes Documentation
- kubernetes/sample-controller (GitHub)
- client-go — k8s.io/client-go
- SharedInformer — pkg.go.dev
- Workqueue — pkg.go.dev