关于 Kubernetes 中 Consul Ingress-Gateway 的问题

Question about Consul Ingress-Gateway in Kubernetes

我想在我的 Kubernetes 集群中设置一个 consul 服务网格,并且需要启用入口网关。我的计划是 运行 ingress-gateway 作为 ClusterIP 服务和 Kubernetes Ingress(Nginx 入口)将流量定向到该入口。我一直在 Consul.io 浏览有关 Ingress Gateway 的教程,但对某些事情感到困惑。掌舵图有一个 gateways: 的列表,其中有一个名称。

示例:

$ cat myingress.hcl
Kind = "ingress-gateway"
# does the following Name need to match kubernetes service
Name = "ingress-gateway"
Listeners = [
  Port = 8080
  ......
]

$ kubectl get services
NAME                          TYPE               CLUSTER-IP      EXTERNAL-IP   PORT(S) 
consul-ingress-gateway        ClusterIP          <blah>          <blah>        8080/TCP,8443/TCP
......

Name field in the configuration entry has to match the name of the service as registered in Consul. By default the Helm chart uses the name "ingress-gateway" (https://www.consul.io/docs/k8s/helm#v-ingressgateways-gateways-name).

您可以使用 name 字段对其进行自定义,该字段必须为 Helm 图表值文件中 ingressGateways.gateways 数组下列出的每个入口网关定义。例如:

---
ingressGateways:
  gateways:
    - name: ingress-gateway
      service: LoadBalancer
      ports:
        - 8080
    - name: nonprod-gateway
      service: LoadBalancer
      ports:
        - 9000