<p>I've setup k3s v1.20.4+k3s1 with Klipper Lb and nginx ingress 3.24.0 from the helm charts.
I'm following <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nginx-ingress-with-cert-manager-on-digitalocean-kubernetes" rel="nofollow noreferrer">this article</a> but I'm stumbling upon a very weird issue where my ingress hosts would point to the wrong service.</p>
<p>Here is my configuration:</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-routing
spec:
  rules:
  - host: echo1.stage.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: echo1
            port:
              number: 80
  - host: echo2.stage.example.com
    http:
      paths:
        - path: /
          pathType: Prefix
          backend:
            service:
              name: echo2
              port:
                number: 80

---
apiVersion: v1
kind: Service
metadata:
  name: echo1
spec:
  ports:
  - port: 80
    targetPort: 5678
  selector:
    app: echo1
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: echo1
spec:
  selector:
    matchLabels:
      app: echo1
  replicas: 2
  template:
    metadata:
      labels:
        app: echo1
    spec:
      containers:
      - name: echo1
        image: hashicorp/http-echo
        args:
        - &quot;-text=This is echo1&quot;
        ports:
        - containerPort: 5678

---
apiVersion: v1
kind: Service
metadata:
  name: echo2
spec:
  ports:
  - port: 80
    targetPort: 5678
  selector:
    app: echo2
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: echo2
spec:
  selector:
    matchLabels:
      app: echo2
  replicas: 1
  template:
    metadata:
      labels:
        app: echo2
    spec:
      containers:
      - name: echo2
        image: hashicorp/http-echo
        args:
        - &quot;-text=This is the new (echo2)&quot;
        ports:
        - containerPort: 5678
</code></pre>
<p>And my Cloudflare DNS records (no DNS proxy activated):</p>
<pre><code>;; A Records
api.stage.example.com.  1   IN  A   162.15.166.240
echo1.stage.example.com.    1   IN  A   162.15.166.240
echo2.stage.example.com.    1   IN  A   162.15.166.240
</code></pre>
<p>But when I do a curl on echo1.stage.example.com multiple times, here is what I get:</p>
<pre><code>$ curl echo1.stage.example.com
This is echo1
$ curl echo1.stage.example.com
&lt;html&gt;
&lt;head&gt;&lt;title&gt;502 Bad Gateway&lt;/title&gt;&lt;/head&gt;
&lt;body&gt;
&lt;center&gt;&lt;h1&gt;502 Bad Gateway&lt;/h1&gt;&lt;/center&gt;
&lt;hr&gt;&lt;center&gt;nginx&lt;/center&gt;
&lt;/body&gt;
&lt;/html&gt;
$ curl echo1.stage.example.com
This is the new (echo2)
</code></pre>
<p>Sometimes I get a bad gateway, sometimes I get the <code>echo1.stage.example.com</code> domain pointing to the service assigned to <code>echo2.stage.example.com</code>. Is this because of the LB? Or a bad configuration on my end? Thanks!</p>
<p>EDIT: It's not coming from the LB, I just switched to metallb and I still get the same issue</p>

E-Kami
<p>Ok I found the issue. It was actually not related to the config I previously posted by to my <code>kustomization.yaml</code> config where I had:</p>
<pre><code>commonLabels:
  app: myapp
</code></pre>
<p>Just removing that <code>commonLabels</code> solved the issue.</p>
