A kubectl plugin that generates YAML for any Kubernetes resource or CRD using the cluster's OpenAPI schema and smart defaults.
- Any resource — works with built-in resources and any installed CRD
- Dynamic short names — queries the API server directly, no hardcoded aliases
- OpenAPI v3 + v2 — tries v3 first (better
oneOf/anyOfsupport), falls back to v2 - Schema comments — field descriptions from the OpenAPI spec are emitted as YAML comments
- Interactive mode — prompts for required field values with type-aware inputs (selects for enums, booleans, key=value for maps)
- Smart defaults — enum first values, format-aware placeholders, commonly-needed fields included by default
# Generate a Deployment
kubectl ditto deployment -n my-namespace my-app
# Generate a CRD resource
kubectl ditto certificates.cert-manager.io -n my-namespace my-cert
# Interactive mode — prompts for values
kubectl ditto deployment -n my-namespace my-app -i
# Minimal output (required fields only)
kubectl ditto deployment -n my-namespace my-app --minimal
# Full output (all fields with defaults)
kubectl ditto deployment -n my-namespace my-app --full
# Suppress description comments
kubectl ditto deployment -n my-namespace my-app --no-commentscargo install --path .kubectl krew install dittoThe binary kubectl-ditto is placed on your PATH. kubectl automatically discovers plugins named kubectl-<subcommand>.
- Discovery — queries
/api/v1and/apisto resolve your input against all resources in the cluster, including dynamic short names from the API server (no hardcoded list) - Schema — fetches the OpenAPI v3 spec (per group/version from
/openapi/v3), falling back to v2 (/openapi/v2) for older clusters. Resolves$refpointers and parsesoneOf/anyOfvariants - Generate — walks the structured schema to produce YAML with:
- Field descriptions as inline
# comments - Smart type-aware defaults
--minimalfor required-only,--fullfor everything--interactivefor prompted input with enum selects, boolean confirms, and map entry
- Field descriptions as inline
- A running Kubernetes cluster (uses your current kubeconfig context)
- CRDs must be installed for custom resources
To publish a new version:
- Tag:
git tag v0.2.0 && git push --tags - Build release binaries for each platform
- Update Krew manifest hashes:
./deploy/krew/update-sha256.sh v0.2.0 - Submit PR to krew-index
