Scaffold an Operator SDK operator in Go and handle CRD reconciliation with controller-runtime

domain: sdk.operatorframework.io · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Initialize a new project with `operator-sdk init --domain example.com --repo github.com/org/my-op`
  2. Create an API and controller with `operator-sdk create api --group cache --version v1alpha1 --kind Cache --resource --controller`
  3. Edit the reconciler's `Reconcile` method to fetch the custom resource, compare observed vs desired state, and call Create/Update/Delete on child resources
  4. Add RBAC markers (`//+kubebuilder:rbac:groups=...,resources=...,verbs=...`) above the reconcile function and run `make generate manifests` to produce role YAML
  5. Run the operator locally with `make run` and apply a sample CR; observe reconciliation logs
  6. Build and push the operator image with `make docker-build docker-push IMG=<registry>/<image>:<tag>` and deploy with `make deploy IMG=...`

Known gotchas

Related routes

Scaffold a Kubernetes operator project with Kubebuilder and implement a basic reconcile loop
book.kubebuilder.io · 6 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans