Skip to content

Kubesplit

Kubesplit splits a multidoc YAML file of Kubernetes descriptors into a set of single-resource files, one file per resource, nicely formatted and organized by namespace.

It reads YAML from a file or STDIN and writes one file per resource into an output directory:

all-in-one.yml  ──►  kubesplit  ──►  output-dir/
                                     ├── 00--namespace--apps-demo.yml
                                     ├── 01--clusterrole--example-node-viewer.yml
                                     └── ingress-controllers/
                                         ├── 20--deployment--traefik-ingress-controller.yml
                                         └── 30--service--traefik-web-ui.yml

Why?

  • Because a single kustomize build or helm template produces a giant multidoc stream that is hard to read and review.
  • Because storing one resource per file — named after its kind and name, grouped by namespace — makes diffs, code reviews and GitOps repositories much easier to navigate.
  • Because the generated files should be consistently formatted: kubesplit reuses yamkix under the hood so every file follows the same opinionated YAML style.

If you just want an opinionated YAML formatter (without the Kubernetes splitting), have a look at yamkix directly.

Documentation

The documentation follows the Diátaxis framework: