Documentation for version v0.40.0 is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date documentation, see the latest version.
ytt is a command-line tool used to template and patch YAML files. It also provides the means to collect fragments and piles of YAML into modular chunks for easy re-use.
In practice, these YAML files are Kubernetes configuration, Concourse Pipeline, Docker Compose, GitHub Action workflow files…, really anything that is in YAML format.
ytt is most useful when manually maintaining these files has or will become too much work.
A plain YAML file is turned into a
ytt template by adding specially formatted comments, that is: annotating. Through these annotations, one can inject input values, logic like conditionals and looping, and perform transformations on the content.
Those “input values” are called “Data Values” in
ytt. Such inputs are included in a separate file.
- see it in action in the load data files example on the playground
- check out the Using Data Values guide
- look up reference details of the programming language used in templates in Language.
Patching (aka Overlaying) ¶
ytt can also be used to patch YAML files. These edits are called “Overlays” and are themselves written in YAML.
For more around overlaying…
- see overlaying in action through a progressive set of examples in the
- learn more about Overlays in ytt Overlays overview;
- for a reference of all Overlay functionality, see Overlay module;
- for a screencast-formatted in-depth introduction to writing and using overlays, watch Primer on
ytt provides powerful techniques for extracting and reusing chunks of YAML and logic.
ytt capture either a calculation or fragment of YAML. Functions can be used in the same templates that define them, or — if defined in a module file — loaded into any template. Entire sets of templates, overlays, and library code can be encapsulated in a
For more about modular code…
- see live examples in the
yttPlayground around functions and
- read further about functions, YAML Fragments, and loading reusable modules and libraries;
- catch-up on a particularly relevant discussion about using modules and libraries in
Further Reading ¶
Hopefully, the pointers above helped get you started. If you’re looking to go either deeper or broader, here are some resources we can recommend.
How it Works
a more detailed look of how all these parts fit together.
ytt vs. X
yttdiffers from similar tools.
ytt: The YAML Templating Tool that simplifies complex configuration management
a complete introduction of
yttincluding motivations and contrasts with other tools.
Deploying Kubernetes Applications with ytt, kbld, and kapp
yttworks well with other Carvel tools.
Presentations and Interviews ¶
IBM Developer podcast: Introducing the YAML Templating Tool (ytt)
a thorough introduction to
yttespecially contrasted with Helm.
TGI Kubernetes: #079: YTT and Kapp
Joe Beda puts both
yttand sister tool
kappthrough their paces.
Helm Summit 2019: ytt: An Alternative to Text Templating of YAML Configuration in Helm (slides)
in-depth review of the philosophy behind
yttand how it differs from other YAML templating approaches.
Kubecon 2020: Managing Applications in Production: Helm vs ytt & kapp @ Kubecon 2020
kappcan provide an alternative way to manage the lifecycle of application on Kubernetes.
Rawkode Live: Introduction to Carvel
Dmitriy joins David McKay to talk through many tools in the Carvel suite, including
(Help improve our docs: edit this page on GitHub)