【发布时间】:2021-01-01 20:42:28
【问题描述】:
我想使用kubectl patch 命令将 DNS 重写规则添加到 coredns 配置映射,如Custom DNS Entries For Kubernetes 中所述。默认配置映射如下所示:
apiVersion: v1
data:
Corefile: |
.:53 {
log
errors
health
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
upstream
fallthrough in-addr.arpa ip6.arpa
ttl 30
}
prometheus :9153
forward . /etc/resolv.conf
cache 30
loop
reload
loadbalance
}
kind: ConfigMap
....
我想添加一行
rewrite name old.name new.name
但是如何指定在“.:53”元素中添加一行让我很困惑。
我知道我可以使用kubectl get ... | sed ... | kubectl replace -f - 获得类似的结果,但这看起来有点难看,而且我想使用 JSON 扩展我对kubctl patch 的了解。谢谢!
【问题讨论】:
标签: patch kubectl configmap coredns