5

我有两个服务,tea每个服务coffee都在自己的命名空间中,我domain.com想去tea服务和domain.com/coffeecoffee.

由于每个都在一个命名空间中,我不得不制作两个入口,但是当我尝试应用它们时,我得到了错误MAPPING Path '/coffee' already defined in another Ingress rule

我的两个入口如下所示:

茶:

kind: Ingress
apiVersion: extensions/v1beta1
spec:
  tls:
  - hosts:
    - domain.com
    secretName: tea-tls
  rules:
  - host: domain.com
    http:
      paths:
      - path: /
        backend:
          serviceName: tea
          servicePort: 80

和咖啡:

kind: Ingress
apiVersion: extensions/v1beta1
metadata:
  name: coffee
  namespace: coffee
spec:
  tls:
  - hosts:
    - domain.com
    secretName: coffee}-tls
  rules:
  - host: domain.com
    http:
      paths:
      - path: /coffee
        backend:
          serviceName: coffee
          servicePort: 80
      - path: /coffee/*
        backend:
          serviceName: coffee
          servicePort: 80
4

2 回答 2

1

我想问题不在于喝茶和咖啡,而是coffee在咖啡入口处两次定义路径。根据https://kubernetes.io/docs/concepts/services-networking/ingress/#simple-fanout我会假设你只需要/coffee路径,并且可以删除/coffee/*路径。

于 2017-07-30T14:12:55.000 回答
-5

根据https://github.com/kubernetes/kubernetes/issues/17088,voyager 入口控制器可以做到这一点。示例(取自链接):

apiVersion: voyager.appscode.com/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  namespace: foo
spec:
  rules:
  - host: foo.bar.com
    http:
      paths:
      - backend:
          serviceName: s1.bar # serviceName.Namespace
          servicePort: '80'
于 2017-07-27T15:16:55.600 回答