K8s configmap很乱

注意
本文最后更新于 2023-11-08 17:06,文中内容可能已过时。

由于配置中存在制表符和行尾有空格导致的

1
2
3
4
5
k get cm nginx-config -o jsonpath='{.data.nginx\.conf}' > nginx.conf

sed -i -E  -e 's/[[:space:]]+$//g' -e 's/\t/    /g' nginx.conf

k create cm nginx-config --from-file nginx.conf --dry-run=client -o yaml | kubectl replace -f -
请我喝杯水
SoulChild 微信号 微信号
SoulChild 微信打赏 微信打赏
0%