【发布时间】:2020-04-22 07:32:15
【问题描述】:
对于我的项目,我需要使用 CoreDNS 覆盖 CNAME DNS 记录以进行内部集群 DNS 解析。 我可以为这样的集群全局执行此操作:
apiVersion: v1
data:
Corefile: |
# Add your CoreDNS customizations as import files.
# Refer to https://cloud.ibm.com/docs/containers?topic=containers-cluster_dns for details.
.:53 {
rewrite name test.example.com example.namespace1.svc.cluster.local
...
}
...
因此,在整个集群中,所有对test.example.com 的请求都将发送到服务:example.namespace1.svc.cluster.local。
是否可以只为特定的命名空间定义重写规则?
例如,我只希望 namespace1 有这个重写规则。
谢谢!
【问题讨论】:
-
我需要类似的东西。你有没有让它在掌舵图中工作?
-
很遗憾没有,最后我们把应用代码从
test.example.com改成了test-example-com,也就是服务的名字。
标签: kubernetes url-rewriting coredns