/devops-skills:operators-and-crdsfrom devops-skills
Guides extending Kubernetes with CustomResourceDefinitions and controllers: designing CRD schemas as stable APIs, writing level-triggered reconcile loops, and deciding when to build an operator versus buy one.
Ships in devops-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A CustomResourceDefinition extends the Kubernetes API with a new resource type; an operator is the controller that watches instances of it and reconciles reality toward what's declared. Together they let you express operational knowledge — "how to safely upgrade this database," "how to provision this cloud resource" — as a Kubernetes-native API instead of a runbook a human executes by hand. That's real leverage, and it's also a commitment: you're now maintaining a piece of distributed systems software, not a script.
The value of an operator is entirely in how well it encodes the operational knowledge a human would otherwise apply manually — a thin operator that just creates a Deployment isn't worth the complexity. Build an operator only when the reconciliation logic is genuinely nontrivial, not because CRDs feel more "cloud native" than a ConfigMap.
A CRD's spec is a contract every consumer (humans, GitOps tooling, other controllers) writes against. Changing field names or semantics after adoption is a breaking change exactly like an external API's, and Kubernetes gives you real tools for this — use them, don't wing the schema.
apiVersion versioning (v1alpha1 → v1beta1 → v1) deliberately — alpha/beta signal
"may change," and only promote to a stable version once the schema has stopped shifting.x-kubernetes-validation / CEL rules) at the API server, not
just in the controller — rejecting a bad spec at kubectl apply time is far better UX than a
reconcile loop silently failing later.status reflects observed state and should only ever be written by the
controller, never by the user; conflating the two is the most common CRD design mistake.Done when: a consumer can write a valid custom resource from the schema and docs alone, without reading the controller's source.
Kubernetes controllers are built around the level-triggered pattern: reconcile is "given the current observed state, make it match the desired state," runnable idempotently at any time, not "react to this specific change event." Any controller that assumes it saw every event in order, or that skips work because "nothing changed since last time" based on the event itself, will drift out of sync the first time it misses an update — and it will miss updates, because that's normal operation (restarts, watch reconnects, rate limiting).
func Reconcile(ctx context.Context, req Request) (Result, error) {
current := fetchActualState(req)
desired := fetchSpec(req)
if !equal(current, desired) {
return applyDiff(current, desired) // safe to re-run from scratch, any time
}
return Result{}, nil
}
Done when: the controller produces the same end state whether it processes every event individually or is restarted and runs one reconcile against final state.
An operator for Postgres, Redis, cert-management, or most other common infrastructure almost certainly already exists, is battle-tested against failure modes you haven't hit yet, and is maintained by people who will keep it working against new Kubernetes versions. Writing your own is justified only when the operational logic is specific to your organization in a way no published operator captures.
scheduled-jobs and workflow-automation.Done when: you can name the specific gap an existing operator didn't cover, if you built one, or name which existing operator you adopted instead of building.
An operator's service account typically needs broad-looking permissions (watch/create/update across
its managed resource types), which makes it a high-value target if compromised — the same
least-privilege discipline from kubernetes-security applies, but with an operator-specific twist:
scope by resource type and, where the operator supports it, by namespace, rather than granting
cluster-wide access because the CRD itself is cluster-scoped.
Done when: kubectl auth can-i --list --as=<operator-sa> shows only the resource types and
verbs the reconcile loop actually touches.
If the operator provisions anything outside Kubernetes' own garbage collection (cloud resources, external DNS records, data in another system), deleting the custom resource without a finalizer orphans that external state permanently. A finalizer blocks deletion until the controller has confirmed cleanup succeeded — skipping this is the most common way operators leak cost or create dangling resources.
Done when: deleting a custom resource is verified to also clean up everything it provisioned outside the cluster, or the finalizer blocks deletion until it does.
State whether the CRD's schema is versioned and validated, confirm the reconcile loop is idempotent and level-triggered, name the build-vs-buy decision and its reasoning, the operator's actual RBAC scope, and the finalizer/cleanup behavior on deletion. Call out any external resource the operator provisions but doesn't yet clean up on deletion — naming that leak is more useful than calling lifecycle management complete.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub arjunprabhulal/devops-skills --plugin devops-skills88 skills in this plugin
/alertingCovers designing alerts that page a human only when a human needs to act — symptom-based alerting over cause-based, multi-window burn-rate alerts on error budgets, severity tiers that route between page/ticket/dashboard, requiring every page to link a runbook, and tuning out alert fatigue. Use this whenever the user is writing a new alert rule, asking why on-call is paged too often or missing real incidents, choosing an alert threshold, or designing severity routing. For the SLO the burn-rate math comes from use `slo-definition`, and for what a runbook should contain use `runbooks`./api-gatewayCovers the managed front-door pattern for APIs — request routing, centralized auth, rate limiting and quotas, request/response shaping, and recognizing when a gateway helps versus becomes a bottleneck or single point of failure. Use this whenever the user is designing an API entry point, adding rate limits or quotas, centralizing auth for several backend services, transforming a request between an external and internal contract, or debugging a gateway timeout. For east-west traffic between internal services use `service-connectivity`, and for token issuance details use `iam-access-management`./argocd-operationsCovers running Argo CD day to day — structuring app-of-apps, choosing sync policies and waves, reading health versus sync status correctly, and unsticking a degraded or hung Application. Use this whenever the user mentions Argo CD, an Application stuck "Progressing" or "OutOfSync," app-of-apps or ApplicationSets, sync waves and hooks, or asks why a deploy shows synced but the workload is unhealthy. For the underlying model this tool implements use `gitops`; for automated canary analysis on top of it use `progressive-delivery`; for the workloads it manages use `kubernetes-operations`./artifact-managementVersions, stores, and promotes build outputs — registries, immutability, build-once-promote-many, retention and garbage collection, and provenance metadata. Use this whenever the user sets up an artifact or container registry, asks how to promote a build between environments without rebuilding, needs a retention or cleanup policy, or wants to trace where an artifact came from. For an image's contents and size use `image-optimization`; for vulnerability scanning use `image-scanning`./autoscalingCovers scaling Kubernetes workloads and nodes to demand — HPA on the right metric, VPA, cluster autoscaler, custom/external metrics, avoiding thrash with stabilization windows, and requests as the foundation underneath it all. Use this whenever the user is configuring an HPA, deciding between HPA and VPA, debugging autoscaling that flaps, or sizing a cluster autoscaler. For the requests/limits autoscaling depends on use `kubernetes-operations`; for cost tradeoffs use `cost-optimization`./backup-and-restoreDefines the discipline of building backups you can actually restore under pressure — RPO-driven frequency, restores rehearsed on a schedule, offsite immutable copies, encryption, and treating a backup that has never been restored as equivalent to no backup at all. Use this whenever the user sets up a backup job, chooses a retention policy, argues about RPO or RTO, asks whether current backups are enough, or plans for ransomware or accidental deletion. For the wider recovery plan use `disaster-recovery`, and for stateful platform durability use `stateful-workloads`.