View
For encoded values.yaml key
kubectl -n $namespace get secret $secret -o yaml | awk '/values.yaml/ {print $2}' | base64 --decode > secret.yamlModify
Make changes to secret.yaml, then
kubectl -n $namespace patch secret $secret -p '{"data": {"values.yaml": "'''$(base64 -w 0 secret.yaml)'''"}}'note Avoid newlines The
-w 0/--wrap=0argument tellsbase64to not wrap the encoded lines after a certain number of characters. If you leave this off, the string gets a newline inserted every 76 characters andkubectlwill puke when trying to parse it.