2
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: hello-world-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /$2
    nginx.ingress.kubernetes.io/add-base-url: "true"
    nginx.ingress.kubernetes.io/use-regex: "true"
    cert-manager.io/cluster-issuer: letsencrypt
spec:
  tls:
  - hosts:
    - mints.cf
    secretName: tls-secret
  rules:
  - host: mints.cf
    http:
      paths:
      - path: /amq(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: activemq-artemis
            port:
              number: 8161
      - path: /*(/|$)(.*)
        pathType: Prefix
        backend:
           service:
            name: mints-ui
            port:
              number: 3000
      - path: /nginx(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: nginx-deployment
            port:
              number: 80
      - path: /kafka(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: kafka-manager
            port:
              number: 9000
      - path: /kibana(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: kibana
            port:
              number: 5601

I Deployed some React JS application into my aks cluster by using deploymentyaml file, and created an Ingress Controller for exposing service with public IP and DNS configuration. Ingress Working other services but it is showing blank page for ReactJS applications. screenshot from browser for reference

Can anyone help me out from this issue?

moonkotte
  • 3,661
  • 2
  • 10
  • 25
  • Does it return 200 code? Also please check `kubectl describe ingress hello-world-ingress`, it'll show all services linked to the Ingress – moonkotte May 10 '21 at 16:15
  • It returning 404 – harish hari May 14 '21 at 10:53
  • As a workaround you can try to add `/` to a separate ingress controller. For some reason `regex` on `/` with `rewrite-target` annotation works somehow differently (didn't figure it out yet) – moonkotte May 14 '21 at 12:40
  • Sorry for delay. I created the same ingress and put behind services with pods using images `mendhak/http-https-echo` which show exact requests and hostnames where requests go. It looks like your ingress setup is correct. Next checks here are 1 - create an `ubuntu` pod and make `curl` requests directly to pod to understand if backend works properly. 2 - show the same screenshot, but with developer tools open + network tab. – moonkotte May 18 '21 at 13:07
  • working fine , issue is my frontend was build on ReactJS , but using Express as Framework, here Ingress doesn't supporting two technologies, either application should be in React or Express. Here we removed Express part, then it worked fine... – harish hari May 20 '21 at 17:26
  • Glad it was resolved! In such case you may want to post an answer on your own question. [Here](https://stackoverflow.com/help/self-answer) is how you can do it. – moonkotte May 20 '21 at 20:59
  • @harishhari, can you please provide the solution , as I am facing same issue. – Lucky Dec 23 '21 at 06:27
  • https://vstsagentpackage.azureedge.net/agent/2.218.1/vsts-agent-win-x64-2.218.1.zip PS C:\> mkdir agent ; cd agent PS C:\agent> Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory("$HOME\Downloads\vsts-agent-win-x64-2.218.1.zip", "$PWD") .\config.cmd .\run.cmd – harish hari Mar 21 '23 at 06:15
  • h4qdidpwqb6zruxxukoaclofsbcx7taxtwvdwu3snkii2swsbwja – harish hari Mar 21 '23 at 06:24

0 Answers0