编辑 kube-system 中的 coredns 这个 ConfigMap,可以:
kubectl edit configmap coredns -n kube-system
在 Corefile 的:
.:53 {
... ...
}
添加:
hosts {
127.0.0.1 localhost
fallthrough
}
如果需要对单个 Pod 级别生效,可以设置 hostAliases。见:
引用
https://stackoverflow.com/a/65283959
https://coredns.io/plugins/hosts/
我还发现了什么好玩的
由于不知道 Corefile 语法高亮应该用啥,于是看到了:
https://coredns.io/2017/07/23/corefile-explained/

发表回复