Kubernetes CoreDNS重写特定命名空间的CNAME记录规则
对于我的项目,我需要用CoreDNS覆盖CNAME DNS记录,以便进行内部群集DNS解析。 对于这样的集群,我可以全局执行此操作:Kubernetes CoreDNS重写特定命名空间的CNAME记录规则,kubernetes,url-rewriting,coredns,Kubernetes,Url Rewriting,Coredns,对于我的项目,我需要用CoreDNS覆盖CNAME DNS记录,以便进行内部群集DNS解析。 对于这样的集群,我可以全局执行此操作: apiVersion: v1 data: Corefile: | # Add your CoreDNS customizations as import files. # Refer to https://cloud.ibm.com/docs/containers?topic=cont
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
有这个重写规则
谢谢大家! 不,不可能通过修改核心DNS的configMap使每个命名空间都有DNS,因为核心DNS是群集范围的DNS。如果您的用例是通过主机名公开服务,那么您可以探索我需要在集群内执行此操作,因为我们的系统指向集群内的
test.example.com
,在服务名称中不可能用点设置名称。现在无法从应用程序点更改test.example.com
。