1

Since 3 days, I have a problem with a deployment in kubernetes. I would like to deploy two react-js application : the first in http://app.my-domain.com and the other in http://app.my-domain.com/shop

NB: the two url is fake, it's just for example.

The first react application was very well deployed in http://app.my-domain.com . Now when i want to put the second react application in http://app.my-domain.com/shop, it's not working.

NB: The two react applications are in different namespaces and exposed with two ingress configurations.

Here are my two ingress configuration which expose my clusterIP services relative to the two react-js applications :

spec:
  rules:
    - host: app.my-domain.com
      http:
        paths:
          - path: /
            backend:
              serviceName: first-service
              servicePort: 80

spec:
  rules:
    - host: app.my-domain.com
      http:
        paths:
          - path: /shop
            backend:
              serviceName: second-service
              servicePort: 80

So I have a blank page with the second application.

Please I would like your help for deploying this two react-js applications in this same domain.

rock'n rolla
  • 1,883
  • 1
  • 13
  • 19
William Bridge
  • 571
  • 3
  • 12
  • It's a lot easier if you just redirect 302 from your first app, and that is the right way to do. – Someone Special Mar 31 '21 at 16:33
  • I don't understand : redirect 302 from the first app in react-js ? PLease could you explain ? – William Bridge Mar 31 '21 at 16:38
  • Are your `first-service` and `second-service` Services in the same Namespaces as your Ingress resources ? Maybe you need to use the `nginx.ingress.kubernetes.io/rewrite-target: /` annotation in your second Ingress resource ? – matt_j Apr 01 '21 at 08:33
  • @matt_j, all about my first application (deployment, service, ingress, configmap) is in a specific namespace and all about my second application (deployment, service, ingress, configmap) is in another namespace. OK thank you, i will try rewrite-target annotation. – William Bridge Apr 01 '21 at 10:04
  • any progress ? Does this comment answer your question or do you still have this problem ? – matt_j Apr 07 '21 at 10:06
  • No it didn't work for me. – William Bridge Aug 21 '21 at 20:59
  • can you add the solution that worked for you? I have 2 react app in same namespace and need to deploy them. – mukesh.kumar Oct 26 '22 at 12:36
  • hello @mukesh.kumar, in the same namespace, there is no problem. You can only use one ingress resource for both services : it should work. – William Bridge Dec 14 '22 at 10:29

1 Answers1

1

I think the simple solution for this, is to use one ingress resource with this domain (app.my-domain.com) and reference the two services with their fqdn : first-service.my-namespace-1.svc.cluster.local, second-service.my-namespace-2.svc.cluster.local.

I am very interested in another solution.

William Bridge
  • 571
  • 3
  • 12