Score:0

How to configure consul to access webpage from Ingress gateway

ke flag

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

Score:0
in flag

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"
uday avatar
ke flag
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
matt_j avatar
in flag
@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.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.