Kubernetes Ingress for same host in different namespace

Viewed 6451

I have two services, tea and coffee, each is in their own namespace, I would like domain.com to go to the tea service and domain.com/coffee to go to coffee.

As each is in a namespace I have had to make two pieces of ingress, but when I try to apply them I get the error MAPPING Path '/coffee' already defined in another Ingress rule.

My two pieces of ingress look like the following:

Tea:

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

and Coffee:

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
2 Answers
Related