<p>I want Ingress to redirect a specific subdomain to one backend and all others to other backend. Basically, I want to define a rule something like the following:</p>

<blockquote>
  <p>If subdomain is <code>foo.bar.com</code> then go to <code>s1</code>, for all other subdomains go to <code>s2</code></p>
</blockquote>

<p>When I define the rules as shown below in the Ingress spec, I get this exception at deployment:</p>

<pre><code>Error: UPGRADE FAILED: cannot re-use a name that is still in use
</code></pre>

<p>When I change <code>*.bar.com</code> to <code>demo.bar.com</code> it works, however.</p>

<p>Here's my Ingress resource spec:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test
spec:
  rules:
  - host: foo.bar.com
    http:
      paths:
      - backend:
          serviceName: s1
          servicePort: 80
  - host: *.bar.com
    http:
      paths:
      - backend:
          serviceName: s2
          servicePort: 80
</code></pre>

<p>Anyone has an idea if it is possible or not?</p>

fyelci
<p>This is now possible in <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/#hostname-wildcards" rel="nofollow noreferrer">Kubernetes</a> with nginx:</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    ingress.kubernetes.io/ssl-redirect: &quot;false&quot;
    kubernetes.io/ingress.class: nginx
    kubernetes.io/ingress.global-static-ip-name: web-static-ip
    nginx.ingress.kubernetes.io/rewrite-target: /$1
    nginx.ingress.kubernetes.io/server-alias: www.foo.bar
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
  name: foo-bar-ingress
  namespace: test
spec:
  rules:
  - host: 'foo.bar.com'
    http:
      paths:
      - backend:
          serviceName: specific-service
          servicePort: 8080
        path: /(.*)
        pathType: ImplementationSpecific
  - host: '*.bar.com'
    http:
      paths:
      - backend:
          serviceName: general-service
          servicePort: 80
        path: /(.*)
        pathType: ImplementationSpecific
</code></pre>
