Agent skill
k8s-workflow
Guide Kubernetes operator development with Kubebuilder, kind, Tilt, and Kustomize. Use when Codex needs to scaffold or iterate on CRDs, controllers, or webhooks; stand up a safe local kind cluster; run a fast operator dev loop; or verify CRDs, pods, and webhook state.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/k8s-workflow
SKILL.md
Kubernetes Operator Workflow
Operate in a dev-only posture. Refuse mutating cluster operations unless the current kubectl context starts with kind-, unless the user explicitly overrides and accepts the risk.
Quick Start
- Run
scripts/prereqs.shfrom the target repo root to check or installkind,kubectl,kustomize,tilt,go, andkubebuilder. - Run
scripts/setup-kind.sh [cluster-name]to create and select a local kind cluster. - Run
scripts/deploy-dev.sh [config/dev]to apply the dev overlay. - Run
scripts/verify-dev.sh [namespace]to inspect CRDs, pods, webhooks, and recent events. - Use
references/command-mapping.mdwhen translating the original Claude plugin commands into Codex actions.
Required Discovery
Ask these before writing code:
- CRD purpose
- Spec fields with types and requiredness
- Status fields
- Webhook type: validating, mutating, or both
- Defaulting rules
- Validation invariants
- RBAC scope: namespaced or cluster-scoped
- Managed child resources
- Webhook failure policy
- Safety gates such as annotations or labels
Build Workflow
- Scaffold with Kubebuilder:
kubebuilder init --domain <domain> --repo <module>kubebuilder create api --group <group> --version v1 --kind <Kind>kubebuilder create webhook --group <group> --version v1 --kind <Kind> --defaulting --programmatic-validation
- Implement CRD types in
api/v1/*_types.go. - Run
make generate && make manifests. - Implement reconcile logic in
internal/controller/*_controller.go. - Implement defaulting and validation in
api/v1/*_webhook.go. - Add the local dev loop with
$k8s-templates. - Prefer
tilt upormake devfor normal iteration.
Manual Fallback Cases
Do a manual build, image load, and apply cycle when:
- CRD schema changed
- Dockerfile or base image changed
- Go dependencies changed in a way that affects the container image
- Tilt is not recovering correctly
Validation
- Verify CRDs are installed.
- Verify manager and webhook pods are healthy.
- Submit a valid sample CR and confirm reconcile activity.
- Submit an invalid CR and confirm webhook rejection.
- Update the target repo
README.mdwith a short runbook covering dev, logs, and sample CR usage.
Safety Notes
scripts/context-guard.shis the portable version of the plugin preflight guard. Use it as a reference or wrapper before mutatingkubectl,helm, orkustomizecommands.- Codex skills do not provide automatic hooks, so apply these guardrails explicitly.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?