我最终修改了“consul-ui”服务(具有IP地址的服务)来公开Consul DNS端口。我将以下内容从“consul”服务(没有集群IP的服务)复制到“consul-ui”服务,在[“spec”] [“port”]部分中:
{ "name": "consuldns-tcp", "protocol": "TCP", "port": 8600, "targetPort": 8600, "nodePort": 30766 }, { "name": "consuldns-udp", "protocol": "UDP", "port": 8600, "targetPort": 8600, "nodePort": 32559 }
然后使用服务IP地址而不是kube-dns ConfigMap中的Pod IP地址。