<p>How is it possible to use more than one domain in the same cluster?</p>
<p>At the moment I've running ONE cluster with <strong>one domain</strong> pointing to a hardware <code>loadbalancer</code> and <code>traefik</code> as an <code>ingress-controller</code>.</p>
<p>Now I wanna add a second domain pointing to different workloads/services.</p>
<p>Do I need</p>
<ol>
<li>a second <code>ingress-controller</code> with a second <code>LoadBalancer</code> (and pointing the second domain to that second LB)?</li>
<li>to point the second domain to the same first <code>LoadBalancer</code> to use only one ìngress-controller`?</li>
</ol>
<p>I am asking, because I have troubles when pointing the second domain to the second <code>Loadbalancer</code> and pointing that one to the existing <code>ingress-controller</code> (nothing happens)
But when I point my <strong>second domain</strong>, to the first Loadbalancer, it seems working as expected.</p>
<p><em>(My guess is: solution &quot;2&quot;)?</em></p>
<p>(I wanna keep one Ingress-controller, thought I need two loadbalanacers)</p>
<p>Does this have to do with the occupied ports 443 and 80?</p>
<p>Thank you</p>

Jan
<blockquote>
<p>a second ingress-controller with a second LoadBalancer (and pointing
the second domain to that second LB)?</p>
</blockquote>
<p><strong>No</strong> there is no requirement for a second LoadBalancer. You can single LB backed by the ingress controller and map the multiple domains.</p>
<p><strong>to point the second domain to the same first LoadBalancer to use only one ìngress-controller`?</strong></p>
<p>Yes, you can use the single ingress controller, inside DNS for both domains you have to add the <strong>A</strong> value of <strong>CNAME</strong> value.</p>
<p>From <strong>DNS</strong> all traffic will get forwarded to <strong>LB</strong>, which is backed by the <strong>ingress controller</strong>.</p>
<p>If you are using the <strong>Nginx ingress controller</strong> different domain or hosts goes like in config</p>
<pre><code>spec:
  rules:
  - host: foobar.com
    http:
      paths:
      - backend:
          serviceName: foobar
          servicePort: 80
  - host: api.foobar.com
    http:
      paths:
      - backend:
          serviceName: foobar
          servicePort: 80
</code></pre>
<p>For <strong>treafik</strong> also it will be the <strong>same</strong>, or else you can create a two separate ingress instead of one.</p>
<p>ingress-1.yaml</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kubernetes-dashboard
spec:
  rules:
  - host: dashboard.test.domain.com
    http:
      paths:
      - path: /
        backend:
          serviceName: frontend
          servicePort: 80
</code></pre>
<p>ingress-2.yaml</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kubernetes-ingress-two
spec:
  rules:
  - host: dashboard.domain.com
    http:
      paths:
      - path: /api
        backend:
          serviceName: backend
          servicePort: 80
</code></pre>
<p>path-based further routing you can implement on ingress.</p>
<p>So you over all arch will be something like</p>
<p>All traffic comes from a single point, <strong>treafik</strong> controller which is exposed as <strong>Loadbalancer</strong> service.</p>
<p>All your other <strong>microservices</strong> will be running as the <strong>ClusterIP</strong>, as we don't want to direct access from the internet.</p>
<p>Read more at : <a href="https://medium.com/kubernetes-tutorials/deploying-traefik-as-ingress-controller-for-your-kubernetes-cluster-b03a0672ae0c" rel="nofollow noreferrer">https://medium.com/kubernetes-tutorials/deploying-traefik-as-ingress-controller-for-your-kubernetes-cluster-b03a0672ae0c</a></p>
