<p>I have an ingress controller and two nginx in one Kubernetes namespace. One service has the name nginx-1 and the second name nginx-2.</p>

<p>I need to create a situation where nginx-1 will be default backend, and nginx-2 will be a target for a few IP addresses.</p>

<p>I have tried to do this using a ConfigMap but without results.</p>

<p>Maybe someone had a problem like this?</p>

ksmar
<p>Never saw on Kubernetes docs something like this, but I would like to purpose another approach. You can configure your ingress to use named based virtual hosting, so that few IP addresses would connect using a different domain.</p>

<p>Here and example:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: name-virtual-host-ingress
spec:
  rules:
  - host: foo.bar.com
    http:
      paths:
      - backend:
          serviceName: service1
          servicePort: 80
  - host: bar.foo.com
    http:
      paths:
      - backend:
          serviceName: service2
          servicePort: 80
</code></pre>

<p>Reference: <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/#name-based-virtual-hosting" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/ingress/#name-based-virtual-hosting</a></p>
