Kong as gateway for configuring multi-domain kubernetes env

we are having 2 different domains for 2 different namespaces
host 1 : dev.example.com mapped to dev namespace
host 2: qa.example.com mapped to qa namespace
and there is service1 in both of them
When I am accessing dev.example.com/service1 it is rendering correctly
But when I am acessing qa.example.com/service1 it is rendering dev service1 pages and not qa ones .
Could you please help

Replicate above scenario - create kong gateway and other resources in kong namespace ( kubectl apply -f https://raw.githubusercontent.com/Kong/kubernetes-ingress-controller/master/deploy/single/all-in-one-dbless.yaml -n kong)

I have edited the kong-proxy service from the above file to point to an External ip

apiVersion: v1
kind: Service
metadata:
annotations:
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
service.beta.kubernetes.io/aws-load-balancer-type: elb
name: kong-proxy
namespace: kong
spec:
ports:

  • name: proxy
    port: 80
    targetPort: 8000
    protocol: TCP
  • name: proxy-ssl
    port: 443
    targetPort: 8443
    protocol: TCP
    selector:
    app: ingress-kong
    type: LoadBalancer
    externalIPs:
    • X.Y.Z

Api services are in respective namespaces (dev and qa) .

I have configured devingress(Ingress resources) in dev namespace and qaingress(Ingress resources) which maps to respective hosts


apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: devingress
namespace: dev
annotations:
configuration.konghq.com: do-not-preserve-host
kubernetes.io/ingress.class: “devingress”
spec:
rules:

  • host: dev.example.com
    http:
    paths:
    • path: /service1/
      backend:
      serviceName: service1-api
      servicePort: 80

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: qaingress
namespace: qa
annotations:
configuration.konghq.com: do-not-preserve-host
kubernetes.io/ingress.class: “qaingress”
spec:
rules:

  • host: qa.example.com
    http:
    paths:
    • path: /service1/
      backend:
      serviceName: service1-api
      servicePort: 80

After adding ingress.class my qa host is not finding host it’s saying
@hbagdi , Could you or anybody else please help

Your Ingress class annotation should be same for both the Ingress resource since they are both being controlled by the same kong ingress controller.

Yes that works … Thank you @hbagdi


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ