---
title: "How to Pretty-Print Your Kubernetes YAML as KYAML and Why You'd Want To"
url: https://daily.dev/posts/how-to-pretty-print-your-kubernetes-yaml-as-kyaml-and-why-you-d-want-to-q6girkgkp
source_url: https://kubernetes.io/blog/2026/08/11/how-to-pretty-print-kubernetes-yaml-as-kyaml
type: article
source: "Kubernetes"
published: 2026-08-12T00:40:03.099Z
updated: 2026-08-12T00:40:34.482Z
tags: ["kubernetes"]
reading_time: 6
upvotes: 10
comments: 1
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Pretty-Print Your Kubernetes YAML as KYAML and Why You'd Want To

**[Kubernetes](https://daily.dev/sources/k8s)** · 6 min read · 10 upvotes · 1 comments

## Summary

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.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://kubernetes.io/blog/2026/08/11/how-to-pretty-print-kubernetes-yaml-as-kyaml>

## 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._

## Community discussion

Top comments from developers on daily.dev.

**@agustinbarrientos** · 0 upvotes

> Brace-heavy edits should stay on generated manifests first

## Similar posts on daily.dev

- [YAML: The Language That Quietly Runs Modern DevOps](https://daily.dev/posts/yaml-the-language-that-quietly-runs-modern-devops-ojznade2q) · Medium · 1 upvotes · 0 comments
- [Kubernetes 1.34 Released with KYAML, Traffic Routing Controls, and Improved Observability](https://daily.dev/posts/kubernetes-1-34-released-with-kyaml-traffic-routing-controls-and-improved-observability-o46tkswao) · InfoQ · 17 upvotes · 0 comments

---

Tags: [#kubernetes](https://daily.dev/tags/kubernetes)

[View this post on daily.dev](https://daily.dev/posts/how-to-pretty-print-your-kubernetes-yaml-as-kyaml-and-why-you-d-want-to-q6girkgkp)
