<p>I'm building a service where users can build web apps - these apps will be hosted under a virtual DNS name *.laska.io</p>

<p>For example, if Tom and Jerry both built an app, they'd have it hosted under:</p>

<pre><code>tom.laska.io
jerry.laska.io
</code></pre>

<p>Now, suppose I have 1000 users. <strong>Should I create one big ingress that looks like this?</strong></p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: nginx-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
  - host: tom.laska.io
    http:
      paths:
      - backend:
          serviceName: nginx-service
          servicePort: 80
  - host: jerry.laska.io
    http:
      paths:
      - backend:
          serviceName: nginx-service
          servicePort: 80          
  ...and so forth             
</code></pre>

<p>I'm worried about downtime - if I have an app with websockets for example. Also the file will become huge with 1000 users. Will reloading the ingress go fast enough? Also, how should I reload it?</p>

<p>A second option in my mind is to <strong>simply create one ingress for every web app</strong>. My worry about that is, can ingress-nginx handle many ingresses? Or is this an anti-pattern?</p>

<p>Which one is better?</p>

Nick
<p>You can create one ingress resource for each web app. If you search the official public charts repo, you'll see that <a href="https://github.com/helm/charts/search?q=ingress&amp;unscoped_q=ingress" rel="noreferrer">many of the charts define an ingress resource within them</a>. It's normal for each app to define its own ingress resource.</p>

<p>It's worth being clear that an ingress resource is just a definition of a routing rule. (It doesn't add an extra ingress controller or any other extra runtime component.) So it makes a lot of sense for an app to define its own routing rule. </p>

<p>The example you've given has all the ingress routing in one resource definition. This approach is easy to grasp and makes a lot of sense when you've got several related applications as then you might want to see their routing configuration together. You can see this also in the <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/#simple-fanout" rel="noreferrer">fanout ingress example in the kubernetes docs</a>.</p>

<p>I can't see any performance concerns with defining the rules separately in distinct resources. The ingress controller will <a href="https://kubernetes.github.io/ingress-nginx/how-it-works/" rel="noreferrer">listen for new rules</a> and update its configuration only when a new rule is created so there shouldn't be a problem with reading the resources. And I'd expect the combined vs separated options to result in the same routing rules being set in the background in nginx.</p>

<p>The most common pattern in the official charts repo is that the chart for each app defines its ingress resource and also exposes it through the values.yaml so that users can choose to enable or customise it as they wish. You can then compose multiple charts together and configure the rules for each in the relevant section of the values.yaml. (Here's an <a href="https://github.com/Activiti/activiti-cloud-charts/blob/95a845ded439d71dc8983d3616fc9ef2de730ce5/activiti-cloud-full-example/values.yaml#L102" rel="noreferrer">example I've worked on that does this</a> with wildcard dns.) Or you can deploy each app separately under its own helm release.</p>
