Question about Consul Ingress-Gateway in Kubernetes

1/15/2021

I'm looking to set up a consul service mesh in my Kubernetes Cluster and need to enable ingress-gateway. My plan is to run ingress-gateway as a ClusterIP Service and Kubernetes Ingress (Nginx ingress) to direct traffic to that ingress. I've been going through the tutorials on Ingress Gateway on Consul.io and am confused by something. The helm chart has a list of gateways: with a name.

  • Does the name of the service built by the helm chart have to match the consul configuration for ingress (minus the prefix applied by helm)?

  • If it does not have to match can I set up multiple consul ingress gateways on the same port?

Example:

$ 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
......
-- Wanderer
consul
kubernetes
servicemesh

1 Answer

1/28/2021

The 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).

You can customize this with the name field which must be defined for each ingress gateway listed under the ingressGateways.gateways array in your Helm chart's values file. For example:

---
ingressGateways:
  gateways:
    - name: ingress-gateway
      service: LoadBalancer
      ports:
        - 8080
    - name: nonprod-gateway
      service: LoadBalancer
      ports:
        - 9000
-- Blake Covarrubias
Source: StackOverflow