<p>I have different applications running in the same Kubernetes Cluster.</p>
<p>I would like multiple domains to access my Kubernetes Cluster and be redirected depending the domain.
For each domain I would like different annotations/configuration.</p>
<p>Without the annotations I have an ingress deployment such as:</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: frontdoor
  namespace: myapps
  annotations:
    kubernetes.io/ingress.class: nginx
    cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
  type: LoadBalancer
  tls:
    - hosts:
        - foo.bar.dev
        - bar.foo.dev
      secretName: tls-secret
  rules:
    - host: foo.bar.dev
      http:
        paths:
          - backend:
              serviceName: foobar
              servicePort: 9000
            path: /(.*)
    - host: bar.foo.dev
      http:
        paths:
          - backend:
              serviceName: varfoo
              servicePort: 80
            path: /(.*)
</code></pre>
<p>But They need to have multiple configuration, for example, one need to have the following annotation</p>
<pre><code>    nginx.ingress.kubernetes.io/rewrite-target: /$1
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
    nginx.ingress.kubernetes.io/affinity: &quot;cookie&quot;
    nginx.ingress.kubernetes.io/session-cookie-name: &quot;PHPSESSID&quot;
    nginx.ingress.kubernetes.io/session-cookie-expires: &quot;172800&quot;
    nginx.ingress.kubernetes.io/session-cookie-max-age: &quot;172800&quot;
</code></pre>
<p>And another would have this one</p>
<pre><code>    nginx.ingress.kubernetes.io/backend-protocol: &quot;FCGI&quot;
    nginx.ingress.kubernetes.io/fastcgi-index: &quot;index.php&quot;
    nginx.ingress.kubernetes.io/fastcgi-params-configmap: &quot;example-cm&quot;
</code></pre>
<p><strong>Those configurations are not compatible</strong>, and I can't find a way to specify a configuration by host.</p>
<p>I also understand that it's impossible to have 2 Ingress serving External HTTP request.</p>
<p>So what am I not understanding / doing wrong ?</p>

BastienSander
<blockquote>
<p>I also understand that it's impossible to have 2 Ingress serving External HTTP request</p>
</blockquote>
<p>I am not sure where you've found this but you totally can do this.</p>
<p>You should be able to create two separate ingress objects like following:</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: frontdoor-bar
  namespace: myapps
  annotations:
    kubernetes.io/ingress.class: nginx
    cert-manager.io/cluster-issuer: letsencrypt-prod

    nginx.ingress.kubernetes.io/rewrite-target: /$1
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
    nginx.ingress.kubernetes.io/affinity: &quot;cookie&quot;
    nginx.ingress.kubernetes.io/session-cookie-name: &quot;PHPSESSID&quot;
    nginx.ingress.kubernetes.io/session-cookie-expires: &quot;172800&quot;
    nginx.ingress.kubernetes.io/session-cookie-max-age: &quot;172800&quot;

spec:
  type: LoadBalancer
  tls:
    - hosts:
        - bar.foo.dev
      secretName: tls-secret-bar
  rules:
    - host: bar.foo.dev
      http:
        paths:
          - backend:
              serviceName: barfoo
              servicePort: 80
            path: /(.*)

---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: frontdoor-foo
  namespace: myapps
  annotations:
    kubernetes.io/ingress.class: nginx
    cert-manager.io/cluster-issuer: letsencrypt-prod

    nginx.ingress.kubernetes.io/backend-protocol: &quot;FCGI&quot;
    nginx.ingress.kubernetes.io/fastcgi-index: &quot;index.php&quot;
    nginx.ingress.kubernetes.io/fastcgi-params-configmap: &quot;example-cm&quot;

spec:
  type: LoadBalancer
  tls:
    - hosts:
        - foo.bar.dev
      secretName: tls-secret-foo
  rules:
    - host: foo.bar.dev
      http:
        paths:
          - backend:
              serviceName: foobar
              servicePort: 9000
            path: /(.*)
</code></pre>
<p>This is a completely valid ingress configuration, and most probably the only valid one that will solve your problem.</p>
<p>Each ingress object configures one domain.</p>
