本文介绍了使用GKE内部负载平衡器的DNS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在GKE上有两个kubernetes集群:一个负责与外界互动的公众,一个私有供内部使用.

I have two kubernetes clusters on GKE: one public that handles interaction with the outside world and one private for internal use only.

公共集群需要访问私有集群上的某些服务,我已经通过内部负载均衡器.当前,我正在为负载均衡器指定要使用的内部IP地址,并将这些IP传递给公共Pod,但是我希望负载均衡器可以选择任何可用的内部IP地址,并且可以将其DNS名称传递给公共Pod.

The public cluster needs to access some services on the private cluster and I have exposed these to the pods of the public cluster through internal load balancers. Currently I'm specifying the internal IP addresses for the load balancers to use and passing these IPs to the public pods, but I would prefer if the load balancers could choose any available internal IP addresses and I could pass their DNS names to the public pods.

内部负载平衡器DNS 可用于常规内部为VM和DNS服务的负载均衡器的格式为[SERVICE_LABEL].[FORWARDING_RULE_NAME].il4.[REGION].lb.[PROJECT_ID].internal,但是GKE上的内部负载均衡器是否可用?还是有一种解决方法可以使我完成类似的工作?

Internal load balancer DNS is available for regular internal load balancers that serve VMs and the DNS will be of the form [SERVICE_LABEL].[FORWARDING_RULE_NAME].il4.[REGION].lb.[PROJECT_ID].internal, but is there something available for internal load balancers on GKE? Or is there a workaround that would enable me to accomplish something similar?

推荐答案

从未听说过GKE中用于负载平衡器的内置DNS,但实际上我们做得很简单.我们有外部DNS Kubernetes服务,该服务管理诸如负载平衡器和入口之类的各种事物的DNS记录.您可以做什么:

Never heard of built-in DNS for load balancers in GKE, but we do it actually quite simply. We have External DNS Kubernetes service which manages DNS records for various things like load balancers and ingresses. What you may do:

  1. 创建Cloud DNS内部区域.确保将其与VPC集成.
  2. 确保您的Kubernetes节点服务帐户具有DNS管理员(或超宽编辑器)权限.
  3. 安装外部DNS.
  4. 使用external-dns.alpha.kubernetes.io/hostname=your.hostname.here
  5. 注释内部负载均衡器服务
  6. 验证DNS记录已创建并且可以在您的VPC中解决.
  1. Create Cloud DNS internal zone. Make sure you integrate it with your VPC(s).
  2. Make sure your Kubernetes nodes service account has DNS Administrator (or super wide Editor) permissions.
  3. Install External DNS.
  4. Annotate your internal Load Balancer service with external-dns.alpha.kubernetes.io/hostname=your.hostname.here
  5. Verify that DNS record was created and can be resolved within your VPC.

这篇关于使用GKE内部负载平衡器的DNS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 12:48