Delete a key
Remove a specific annotation from YAML
yq -i 'del(.metadata.annotations."kubectl.kubernetes.io/last-applied-configuration")' resource.yaml
More yq commands
-
yq eval-all 'select(fileIndex==0) * select(fileIndex==1)' base.yaml override.yamlDeep-merge two YAML documents
-
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