0

I am trying to configure ingress gateway for consul deployed in AKS.

As per their documentation , I have created a sample deployment and ingress gateway to it.

yaml files: github

kubectl apply -f static-app/

I changed the static app service from CluserIP to LoadBalancer and can get the page using http://<LB_IP>

But, with ingress gateway, I can access only by adding the header as below:

curl -H "Host: static-server.ingress.consul" "http://<IG_IP>:8080"

If I try without header, it is not getting the page.

Any suggestion on how to make it work without header, so that I can utilize the same for my main application.

Once, it is deployed, I am able to see in the consul window and got the IP address of the ingress-gateway using

matt_j
  • 350
  • 2
  • 6
uday
  • 257
  • 2
  • 21

1 Answers1

0

You need to modify the IngressGateway resource. Add the Hosts array with the wildcard specifier (*) and then apply the changes.

$ cat ingress-gateway.yaml
apiVersion: consul.hashicorp.com/v1alpha1
kind: IngressGateway
metadata:
  name: ingress-gateway
spec:
  listeners:
    - port: 8080
      protocol: http
      services:
        - name: static-server
          hosts:
          - "*"
      
$ kubectl apply -f ingress-gateway.yaml
ingressgateway.consul.hashicorp.com/ingress-gateway configured 

We can check if it works as expected:

$ curl http://<IG_IP>:8080
"hello world"
matt_j
  • 350
  • 2
  • 6
  • THank you it worked but the labelling is bit confusing. I tried creating a different service again and added one more listener to the k8s, but it is not routing. Ignore the port in the ingress as I just changed for testing. Please suggest how to set this. https://github.com/thunderbirds-2021/consul-testing/tree/main/static-app2 – uday Jul 13 '21 at 15:46
  • @uday If my answer was helpful to you please consider accepting the answer or vote on it. If you have another question, please create a new question. That way it would be more clear and visible for the rest of the community. – matt_j Jul 14 '21 at 11:00