Two YAML documents in one file
Use `---` to separate resources or configs.
app: api
port: 8080
---
app: worker
port: 9090Common in Kubernetes and other tools that process a stream of YAML documents.
Document separators, multi-resource YAML files, and commands for splitting, filtering, and validating streamed YAML.
Store multiple YAML documents in one file with `---` separators.
Use `---` to separate resources or configs.
app: api
port: 8080
---
app: worker
port: 9090Common in Kubernetes and other tools that process a stream of YAML documents.
Use `...` to mark the end of a document when needed.
name: sample
...The end marker is less common, but it can help in streamed or generated YAML.
Send several Kubernetes resources in one file.
kubectl apply -f stack.yamlKubernetes commonly uses one file containing Namespace, Deployment, Service, Ingress, and more.
Write each YAML document to its own output file.
yq -s '.metadata.name' stack.yamlUseful when a generated manifest needs to be broken into individual resource files.
Commands for reading the right document from a YAML stream.
yq 'select(documentIndex == 0)' stack.yamlHelpful when a file contains multiple resources and you only need one.
Filter documents in a manifest stream.
yq 'select(.kind == "Deployment")' stack.yamlA fast way to inspect or extract just one type of resource from a large manifest.
Generate YAML output for inspection before deployment.
helm template myapp ./chartRendered YAML is easier to lint, diff, and review before applying changes.