DEV Community

Carlos Mendible
Carlos Mendible

Posted on • Originally published at carlos.mendible.com on

2

AKS and Application Gateway: Expose more than one service in an ingress resource

If you install the Azure Aplication Gateway Ingress Controller for your AKS clusters you may want to expose more than one service through the same Public IP just changing the url path. In order to make this work you must use the backend-path-prefix annotation.

In the following sample I create an ingress with the following behavior:

  1. Calls to http://[Waf Pulic IP or DNS]/inventory are sent to the inventory service
  2. Calls to http://[Waf Pulic IP or DNS]/orders are sent to the orders service
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: backend-ingress
  annotations:
    # Service are serving content in this path.
    appgw.ingress.kubernetes.io/backend-path-prefix: "/"
    kubernetes.io/ingress.class: azure/application-gateway
spec:
  rules:
  - http:
      paths:
      - path: /inventory/*
        backend:
          serviceName: inventory
          servicePort: 80
      - path: /orders/*
        backend:
          serviceName: orders
          servicePort: 80
Enter fullscreen mode Exit fullscreen mode

Note that the appgw.ingress.kubernetes.io/backend-path-prefix value is set to: / which means that the paths specified in the rules are rewritten to this value qhen sent to your services.

Hope it helps.

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay