<p>I'm pretty new to K8s.</p>
<p>I'm trying to make my app visible to the outside world. I have deployed <a href="https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-helm/#configuration" rel="nofollow noreferrer">this</a> Nginx Ingress Controller with my apps, using Helm and <a href="https://github.com/helmfile/helmfile" rel="nofollow noreferrer">helmfile</a> which has given me an external ip address and a load balancer.</p>
<p>As I understand it, I now need an <code>ingress resource</code> to configure the route mappings.</p>
<p>I plan on using this ingress resource as a starting point.</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: minimal-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  ingressClassName: nginx-example
  rules:
  - http:
      paths:
      - path: /testpath
        pathType: Prefix
        backend:
          service:
            name: test
            port:
              number: 80
</code></pre>
<p>My apps are deployed in separate namespaces on port 80.</p>
<p>My question is: where do I put the yaml for creating the resources?</p>
<p>I want to keep everything in Helm if possible to make managing the configuration easier, so I don't want to use <code>kubectl</code> unless i have to.</p>
<h2>My helmfile</h2>
<pre><code>repositories:
 
- name: stable
  url: https://charts.helm.sh/stable
- name: nginx-stable
  url: https://helm.nginx.com/stable

releases:

  # other apps configured here

  - name: ingress-nginx
    namespace: ingress
    createNamespace: true
    chart: nginx-stable/nginx-ingress
    values:
      - ./ingress/values.yaml
    version: 0.10.4
    installed: true 
</code></pre>
<h2>My Ingress Controller values.yaml:</h2>
<pre><code>---
rbac:
  create: true

serviceAccount:
  create: true
  name: nginx-ingress-public

controller:
  ingressClassResource:
    enabled: true
    default: true

  replicaCount: 3
  minAvailable: 3
  updateStrategy:
    rollingUpdate:
      maxSurge: 3
      maxUnavailable: 0
</code></pre>

<p>You should deploy the ingress controller only once as it can handle <em>all</em> ingress traffic for your whole cluster.</p>
<p>Sometimes it makes sense to deploy multiple, for example we run 2 ingress controller. 1 for internal traffic (private IP) and one for external traffic (public IP).</p>
<p>Once you have that, you just tell your other helm releases to use its ingress class.</p>
<p>The ingress manifest is usually a template of your helm chart. So you put it in templates. If you do <code>helm create my-app</code>, you get a good starting point, including ingress.</p>
<p>Once you have an ingress template in your chart, you can add some reasonable defaults for this template to the values.yaml of the chart, as usual.</p>
<p>When deploying the chart, you can use certain flags to override the defaults. i.e. <code>-f</code> and <code>--set</code>.</p>
