【问题标题】:Kubernetes CoreDNS rewrite CNAME record rules for specific namespaceKubernetes CoreDNS 重写特定命名空间的 CNAME 记录规则
【发布时间】: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


【解决方案1】:

不,不可能通过修改核心 DNS 的 configMap 来为每个命名空间设置 DNS,因为 coreDNS 是集群范围的 DNS。如果您的用例是通过主机名公开服务,那么您可以探索ingress

【讨论】:

  • 我需要在集群内部执行此操作,因为我们的系统指向集群内部的test.example.com,并且在服务名称中无法使用点设置名称。现在无法从应用程序点更改 test.example.com
猜你喜欢
  • 1970-01-01
  • 2023-03-21
  • 1970-01-01
  • 1970-01-01
  • 2020-04-30
  • 2016-06-24
  • 2012-03-26
  • 2011-12-18
  • 1970-01-01
相关资源
最近更新 更多