2

我有以下入口配置,但是当我调用它时,总是打开我的 UI 服务而不是 API,如果我在apiwww.domain.com/api之后调用其他东西,也会发生同样的事情,例如。www.domain.com/api/v1/projects

我该如何解决?

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingress
spec:
  tls:
  - secretName: tls
  backend:
    serviceName: ui
    servicePort: 5003
  rules:
  - host: www.domain.com
    http:
      paths:
      - path: /
        backend:
          serviceName: ui
          servicePort: 5003
      - path: /api
        backend:
          serviceName: api
          servicePort: 5000
4

1 回答 1

2

这是我解决此问题的方法。我希望这可以帮助其他人。

谢谢@aleks!!

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kronus
spec:
  tls:
  - secretName: tls
  backend:
    serviceName: ui
    servicePort: 5003
  rules:
  - host: domain.com
    http:
      paths:
      - path: /api
        backend:
          serviceName: api
          servicePort: 5000
      - path: /api/*
        backend:
          serviceName: api
          servicePort: 5000
  - host: www.domain.com
    http:
      paths:
      - path: /api
        backend:
          serviceName: api
          servicePort: 5000
      - path: /api/*
        backend:
          serviceName: api
          servicePort: 5000
于 2017-03-10T04:04:05.773 回答