Remove an unwanted field from YAML.
Section: Edit and transform YAML with yq
Delete a key
bash
bash
yq -i 'del(.metadata.annotations)' deployment.yamlExplanation
Helpful when stripping environment-specific or generated data.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Edit and transform YAML with yq