Jie Fang
Jie Fang

Reputation: 1

How to connect backend and frontend correctly with same url in Jenkins-x

I use jenkins-x to deploy front-end and back-end projects, and I want to use the same url in ingress with different paths. The frontend uses mysite.com, and the backend uses mysite.com/api. At first, I wanted to directly modify "charts/my-project/template/ingress" to achieve the goal, but when the backend was deployed to gke, he did not Use the correct address, but use the default address of gke, and generate two addresses like .., ../api, I don’t Understand why this happens, is there any good way to solve this problem?

spec:
  rules:
  - host: mysite.com
    http:
      paths:
      - path: /api
        backend:
          serviceName: {{ .Values.service.name }}
          servicePort: 8080

Upvotes: 0

Views: 404

Answers (1)

Veve
Veve

Reputation: 6758

You can set your frontend and your backend on the same domain like this:

 spec:
   rules:
   - host: mysite.com
     http:
       paths:
       - backend:
           serviceName: <your-frontend-service-name>
           servicePort: 80
         path: /
       - backend:
           serviceName: <your-backend-service-name>
           servicePort: 8080
         path: /api

Upvotes: 0

Related Questions