Delete a key yq
Remove a specific annotation from YAML
yq -i 'del(.metadata.annotations."kubectl.kubernetes.io/last-applied-configuration")' resource.yaml
more yq
all 15 commands →
Merge two YAML files
yq eval-all 'select(fileIndex==0) * select(fileIndex==1)' base.yaml override.yaml
Convert YAML to JSON
yq -o=json '.' config.yaml
Convert JSON to YAML
cat config.json | yq -P '.'
Filter array items by condition
yq '.items[] | select(.status.phase == "Running")' pods.yaml
Update image tag across manifests
yq -i '(.spec.template.spec.containers[] | select(.name == "app") | .image) = "myapp:v2.0.0"' deployment.yaml