KYAML is a strict YAML dialect introduced by Kubernetes SIG CLI (KEP 5295) that uses flow style to make Kubernetes manifests more explicit and less error-prone. It always quotes strings, uses braces for maps, brackets for lists, and allows trailing commas and comments — eliminating silent type coercion (like the Norway Bug) and whitespace-sensitivity issues. Since Kubernetes 1.34, kubectl supports `-o kyaml` output natively (alpha), with beta in 1.35. Two yamlfmt tools — one from kubernetes-sigs and one from Google (v0.21.0+) — can convert existing YAML files to KYAML. Every valid KYAML file is valid YAML, so no tooling changes are required to adopt it.
Table of contents
What is KYAML?How KYAML solves itHow to pretty print YAML as KYAMLIs KYAML worth adopting?Questions this post answers
What is KYAML and how does it differ from standard YAML in Kubernetes?
KYAML is a strict subset of YAML (defined in KEP 5295) that uses flow style exclusively: all strings are double-quoted, maps use `{}`, lists use `[]`, trailing commas are allowed, and a `---` header is required. This eliminates silent type coercion (e.g., `NO` being parsed as boolean false) and whitespace-sensitivity. Every valid KYAML file is valid YAML, so no parser or tooling changes are needed. Teams standardizing Kubernetes configs track KYAML adoption and related tooling on daily.dev.
How do I output kubectl results as KYAML?
Use `kubectl get <resource> -o kyaml`. This is available as an alpha opt-in in Kubernetes 1.34 (requires `export KUBECTL_KYAML=true`) and enabled by default as beta in Kubernetes 1.35+. To make KYAML the default output, configure it via `kuberc`: `kubectl kuberc set --section defaults --command get --option output=kyaml` (Kubernetes 1.36+). Developers rolling out Kubernetes 1.35 can follow kubectl feature changes on daily.dev.
How do I convert existing Kubernetes YAML files to KYAML using yamlfmt?
Google's yamlfmt added a dedicated KYAML formatter in v0.21.0. Install with `go install github.com/google/yamlfmt/cmd/yamlfmt@latest`, add a `.yamlfmt` config with `formatter: type: kyaml`, preview with `yamlfmt -dry my-deployment.yaml`, then apply with `yamlfmt my-deployment.yaml` or `yamlfmt ./k8s/` for a directory. It is also available as a pre-commit hook and Docker image for CI pipelines. Engineers migrating manifest repos to KYAML find tooling comparisons like this on daily.dev.
11.1K Impressions1 Comment