0

My modern application hosted within kubernetes works based on the host and the path app.dev.sandbox.com/ (root / path). I need access external legacy application hosted on EC2/VM with host name app-legacy.dev.sandbox.com via the kubernetes ingress. I want to be able to access the legacy sites pages with the same host name of application deployed on kubernetes like this app.dev.sandbox.com/nbs/login or app.dev.sandbox.com/nbs/homepage.do should actually request app-legacy.dev.sandbox.com/abc/login or app-legacy.dev.sandbox.com/nbs/homepage.do but preserve the modern hostname of app.dev.sandbox.com when displaying the page. This is needed because, we are using strangler fig pattern to navigate between legacy and modern pages seamlessly. The request needs to be captured by the kubernetes ingress when the user clicks on certain links on the legacy pages. I am currently using the following external service and ingress resource.

apiVersion: v1
kind: Service
metadata:
 name: nbs-legacy
spec:
  type: ExternalName
  externalName: app-legacy.dev.sandbox.com
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-resource
  annotations:
    kubernetes.io/ingress.class: "nginx"  
    cert-manager.io/cluster-issuer: "letsencrypt-production"
    nginx.ingress.kubernetes.io/rewrite-target: /  
    nginx.ingress.kubernetes.io/preserve-host: "true"
spec:
 ingressClassName: nginx
 tls:
 - secretName: app.dev.sandbox.com
   hosts:
   - app.dev.sandbox.com
 rules:
 - host: app.dev.sandbox.com
   http:
    paths:
    - path: /nbs     #I would like the path to be appened to the nbs-legacy request. For example /nbs/login should be appened while requesting app-legacy.dev.sandbox.com/nbs/login
      pathType: Exact
      backend:
       service:
       name: nbs-legacy
       port:
         number: 80
    - path: /
      pathType: Prefix
      backend:
        service:
        name: modern-service
        port:
         number: 80

I am using nginx ingress. I tried with the above manifests but did not work. I am expecting the following:

  1. Navigate to external legacy application seamlessly while preserving the host name of the kubernetes.
  2. Capture path from the request and pass that to legacy host name request. For example, /nbs/login or /nbs/dashboard should be passed when requesting legacy application pages.
  3. Avoid routing of anything that starts with /nbs(eg: /nbs/abc) to the default root / path.
RVP
  • 1
  • 1

0 Answers0