简体   繁体   English

如何在 GKE/kubedns 中使用 FQDN 将流量路由到 k8s 服务

[英]How to route traffic to k8s services using FQDN in GKE/kubedns

I am trying to search for equivalent for rewrite name in coreDNS for kube-dns.我正在尝试在 kube-dns 的 coreDNS 中搜索rewrite name的等效项。

Am deploying a GKE cluster and kube-dns is available by default.我正在部署 GKE 集群,默认情况下 kube-dns 可用。

I need to use URL with company name even for intra-cluster traffic.即使是集群内流量,我也需要使用 URL 和公司名称。 For example, if the pod calls servicename-d1.subdomain.example.com it should go to servicename.d1.svc.cluster.local .例如,如果 pod 调用servicename-d1.subdomain.example.com它应该是 go 到servicename.d1.svc.cluster.local There won't be any external request to the URL不会有任何外部请求到 URL

Any way to implement this.任何方式来实现这一点。

Referring to this, Gitlink helps in re-writing the DNS service.参照此, Gitlink帮助重写了 DNS 服务。 This rewrite plugin offers the ability to match the name in the question section of a DNS request.这个重写插件提供了匹配 DNS 请求的问题部分中的名称的能力。 The match could be exact, a substring match, or based on a prefix, suffix, or regular expression.匹配可以是精确匹配、substring 匹配,或者基于前缀、后缀或正则表达式。 If the newly used name is not a legal domain name, the plugin returns an error to the client.如果新使用的名称不是合法域名,则插件会向客户端返回错误。 The syntax for name rewriting is as follows:名称重写的语法如下:

rewrite [continue|stop] name [exact|prefix|suffix|substring|regex] STRING STRING [OPTIONS]

You can also proceed by Kube.netes: Routing Internal Services Through FQDN refer to link2 for more information on DNS for Services and Pods.您也可以通过 Kube.netes 继续: 通过 FQDN 路由内部服务,请参阅链接 2 以获取有关服务和 Pod 的DNS的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM