Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes Ingress for same host in different namespace

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
like image 877
Simon I Avatar asked Nov 27 '22 19:11

Simon I


1 Answers

I guess the problem isn't having tea and coffee, but defining the coffee path twice in the coffee ingress. According to https://kubernetes.io/docs/concepts/services-networking/ingress/#simple-fanout I would assume that you only need the /coffee path, and can delete the /coffee/* path.

like image 123
slintes Avatar answered Dec 04 '22 01:12

slintes