title: Is it possible to use same hostname with multiple Ingress resources running in different namespaces?
body: <p>I want to use the same hostname let's say <code>example.com</code> with multiple Ingress resources running in different namespaces i.e <code>monitoring</code> and <code>myapp</code>. I'm using <strong>Kubernetes nginx-ingress</strong> controller.</p>
  <p><strong>haproxy-ingress.yaml</strong></p>
  <pre><code>apiVersion: networking.k8s.io/v1
  kind: Ingress
  metadata:
    name: haproxy-ingress
    namespace: myapp
    annotations:
      kubernetes.io/ingress.class: &quot;nginx&quot;  
  spec:
    tls:
    - hosts:
      # fill in host here
      - example.com
      
    rules:
      - host: example.com
        http:
          paths:
            - path: /
              pathType: Prefix
              backend:
                service:
                  name: haproxy
                  port:
                    number: 80
  
  </code></pre>
  <p><strong>grafana-ingress.yaml</strong></p>
  <pre><code>apiVersion: networking.k8s.io/v1
  kind: Ingress
  metadata:
    name: grafana-ingress
    namespace: monitoring
    annotations:
      nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
  spec:
    tls:
    - hosts:
      - example.com
      
    rules:
      - host: example.com
        http:
          paths:
            # only match /grafana and paths under /grafana/
            - path: /grafana(/|$)(.*)
              pathType: Prefix
              backend:
                service:
                  name: grafana
                  port:
                    number: 3000
  
  </code></pre>
  <p>When I'm doing <code>curl example.com</code> then it is redirecting me to the deployment running in namespace one(as expected) but when I'm doing <code>curl example.com/grafana</code> then still it is redirecting me to namespace one deployment.</p>
  <p>Please help.</p>