Merge two YAML files
Deep-merge two YAML documents
yq eval-all 'select(fileIndex==0) * select(fileIndex==1)' base.yaml override.yaml
More yq commands
-
yq -o=json '.' config.yamlOutput YAML document as JSON
-
cat config.json | yq -P '.'Pretty-print JSON as YAML
-
yq '.items[] | select(.status.phase == "Running")' pods.yamlSelect only Running pods from a list
-
yq -i '(.spec.template.spec.containers[] | select(.name == "app") | .image) = "myapp:v2.0.0"' deployment.yamlTargeted image update for a named container
-
yq '.metadata.name' manifests/*.yamlExtract metadata.name from all YAML files in a directory