<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-to-pretty-print-your-kubernetes-yaml-as-kyaml-and-why-you-d-want-to-q6girkgkp" -->

---
title: How to Pretty-Print Your Kubernetes YAML as KYAML and...
description: 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...
canonical: https://daily.dev/posts/how-to-pretty-print-your-kubernetes-yaml-as-kyaml-and-why-you-d-want-to-q6girkgkp
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How to Pretty-Print Your Kubernetes YAML as KYAML and Why You'd Want To | daily.dev
og:description: 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...
og:url: https://daily.dev/posts/how-to-pretty-print-your-kubernetes-yaml-as-kyaml-and-why-you-d-want-to-q6girkgkp
og:image: https://api.daily.dev/og/posts/Q6GirKGKP.png
og:image:alt: How to Pretty-Print Your Kubernetes YAML as KYAML and Why You'd Want To
og:image:width: 1200
og:image:height: 630
og:locale: 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

### How do I get kubectl to output Kubernetes resources in KYAML format?

In Kubernetes 1.34, KYAML output is alpha and opt-in, requiring the environment variable KUBECTL_KYAML=true before running kubectl get deployment my-app -o kyaml. In Kubernetes 1.35+, KYAML is beta and enabled by default, so the -o kyaml flag alone works without any environment variable, e.g. kubectl get deployment my-app -o kyaml.

_Track kubectl output format changes like kyaml support on daily.dev before your next cluster upgrade._

### What is the Norway Bug in YAML and how does KYAML fix it?

The Norway Bug refers to standard YAML parsing the unquoted value NO (as in country: NO) as the boolean false instead of the string "NO", due to implicit type coercion. KYAML fixes this by always quoting value strings, such as country: "NO", so type coercion never happens silently and structure is explicit.

_Developers hardening config parsing against silent YAML type coercion can follow fixes like this on daily.dev._

### How can I convert an existing Kubernetes YAML manifest to KYAML format using yamlfmt?

Google's yamlfmt added a dedicated kyaml formatter in v0.21.0: install it via go install github.com/google/yamlfmt/cmd/yamlfmt@latest, add a .yamlfmt config with formatter type kyaml, then run yamlfmt my-deployment.yaml to convert, or yamlfmt -dry my-deployment.yaml to preview first. Alternatively, sigs.k8s.io/yaml ships its own yamlfmt tool using yamlfmt -o=kyaml my-deployment.yaml.

_Teams standardizing manifest formatting can find tooling comparisons like this yamlfmt walkthrough 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
- [What is a YAML file? A guide from basics to practical use](https://daily.dev/posts/what-is-a-yaml-file-a-guide-from-basics-to-practical-use-csgfspcyo) · GitLab · 3 upvotes · 0 comments
- [Beyond YAML in Kubernetes: The 2026 Automation Era](https://daily.dev/posts/beyond-yaml-in-kubernetes-the-2026-automation-era-0a0hgzsbj) · Pulumi · 5 upvotes · 0 comments
- [YAML? That’s Norway problem](https://daily.dev/posts/yaml-that-s-norway-problem-jgyckvk2a) · Programming Digest · 4 upvotes · 0 comments
- [Validating, scoring, and gating Kubernetes configuration after every change](https://daily.dev/posts/validating-scoring-and-gating-kubernetes-configuration-after-every-change-1umvnppcm) · ITNEXT · 0 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)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"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","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-to-pretty-print-your-kubernetes-yaml-as-kyaml-and-why-you-d-want-to-q6girkgkp"},"datePublished":"2026-08-12T00:40:03.099Z","dateModified":"2026-09-14T08:56:36.517Z","description":"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...","image":"https://media.daily.dev/image/upload/s--foaA6JGU--/f_auto/v1722860399/public/Placeholder%2004","thumbnailUrl":"https://media.daily.dev/image/upload/s--foaA6JGU--/f_auto/v1722860399/public/Placeholder%2004","isAccessibleForFree":true,"articleSection":"Kubernetes","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Kubernetes","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/k8s","url":"https://daily.dev/sources/k8s"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/how-to-pretty-print-your-kubernetes-yaml-as-kyaml-and-why-you-d-want-to-q6girkgkp","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":10},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"kubernetes","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Kubernetes","item":"https://daily.dev/sources/k8s"},{"@type":"ListItem","position":3,"name":"How to Pretty-Print Your Kubernetes YAML as KYAML and Why You'd Want To"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/how-to-pretty-print-your-kubernetes-yaml-as-kyaml-and-why-you-d-want-to-q6girkgkp","comment":[{"@type":"Comment","text":"Brace-heavy edits should stay on generated manifests first","datePublished":"2026-08-18T03:31:08.220Z","url":"https://daily.dev/posts/Q6GirKGKP#c-8jzjlmuZs","author":{"@type":"Person","name":"Agustin Barrientos","url":"https://daily.dev/agustinbarrientos","image":"https://media.daily.dev/image/upload/s--5ayxQnqn--/f_auto/v1788281802/avatars/avatar_wQYYVe5Tbj0NJ7C7qPoa8?_a=BAMAMicg0"}}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-to-pretty-print-your-kubernetes-yaml-as-kyaml-and-why-you-d-want-to-q6girkgkp#faq","mainEntity":[{"@type":"Question","name":"How do I get kubectl to output Kubernetes resources in KYAML format?","acceptedAnswer":{"@type":"Answer","text":"In Kubernetes 1.34, KYAML output is alpha and opt-in, requiring the environment variable KUBECTL_KYAML=true before running kubectl get deployment my-app -o kyaml. In Kubernetes 1.35+, KYAML is beta and enabled by default, so the -o kyaml flag alone works without any environment variable, e.g. kubectl get deployment my-app -o kyaml. Track kubectl output format changes like kyaml support on daily.dev before your next cluster upgrade."}},{"@type":"Question","name":"What is the Norway Bug in YAML and how does KYAML fix it?","acceptedAnswer":{"@type":"Answer","text":"The Norway Bug refers to standard YAML parsing the unquoted value NO (as in country: NO) as the boolean false instead of the string \"NO\", due to implicit type coercion. KYAML fixes this by always quoting value strings, such as country: \"NO\", so type coercion never happens silently and structure is explicit. Developers hardening config parsing against silent YAML type coercion can follow fixes like this on daily.dev."}},{"@type":"Question","name":"How can I convert an existing Kubernetes YAML manifest to KYAML format using yamlfmt?","acceptedAnswer":{"@type":"Answer","text":"Google's yamlfmt added a dedicated kyaml formatter in v0.21.0: install it via go install github.com/google/yamlfmt/cmd/yamlfmt@latest, add a .yamlfmt config with formatter type kyaml, then run yamlfmt my-deployment.yaml to convert, or yamlfmt -dry my-deployment.yaml to preview first. Alternatively, sigs.k8s.io/yaml ships its own yamlfmt tool using yamlfmt -o=kyaml my-deployment.yaml. Teams standardizing manifest formatting can find tooling comparisons like this yamlfmt walkthrough on daily.dev."}}]}
```

