<p>I use the helm-chart ingress-nginx (4.0.x) to create the ingress-controller and use it to direkt tcp traffic via a node-port to my deployment (which works perfectly). But I see that the ingress-controller constantly opens and closes tcp connection to the pod of my deployment.
Does anybody know why this happens or how I can configure it?</p>
<p>My current configuration for the ingress-nginx chart is</p>
<pre class="lang-yaml prettyprint-override"><code>ingress-nginx:
  controller:
    replicaCount: 2
    nodeSelector:
      beta.kubernetes.io/os: linux
    admissionWebhooks:
      patch:
        nodeSelector:
          beta.kubernetes.io/os: linux
    service:
      annotations:
        service.beta.kubernetes.io/azure-load-balancer-internal: &quot;true&quot;
  defaultBackend:
    nodeSelector:
      beta.kubernetes.io/os: linux
  tcp:
    6203: storage-he10/lb-plc-in-scale-service:6203
</code></pre>
<pre><code>2021-09-08 06:19:07.3733333 Tcp-Connection closed (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.0.47:48494)
2021-09-08 06:19:07.3766667 Tcp-Connection accepted (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.0.47:48576)
2021-09-08 06:19:09.0666667 Tcp-Connection closed (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.0.47:48518)
2021-09-08 06:19:09.0700000 Tcp-Connection accepted (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.1.83:58122)
2021-09-08 06:19:13.3900000 Tcp-Connection closed (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.0.47:48576)
2021-09-08 06:19:13.3933333 Tcp-Connection accepted (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.1.83:58156)
2021-09-08 06:19:15.0700000 Tcp-Connection closed (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.1.83:58122)
2021-09-08 06:19:15.0700000 Tcp-Connection accepted (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.1.83:58184)
2021-09-08 06:19:19.3933333 Tcp-Connection closed (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.1.83:58156)
2021-09-08 06:19:19.3966667 Tcp-Connection accepted (PlcService: SVC_IN_SCALE, Port: 6203, Client: 10.244.0.47:48768)
</code></pre>
<p>and <code>helm template</code> produces following code for my deployment</p>
<pre class="lang-yaml prettyprint-override"><code>---
apiVersion: v1
kind: Service
metadata:
  name: lb-plc-in-scale-service
  namespace: storage-he10
  labels:
    siteName: he10
spec:
  type: NodePort
  selector:
    app: plc-in-scale-service
  ports:
    # By default and for convenience, the `targetPort` is set to the same value as the `port` field.
    - port: 6203
...
---
# Source: he10/templates/servers.yaml
kind: Deployment
apiVersion: apps/v1
metadata:
  name: plc-in-scale-service
  namespace: storage-he10
  labels:
    siteName: he10
spec:
  replicas: 
  selector:
    matchLabels:
      app: plc-in-scale-service
  template:
    metadata:
      labels:
        app: plc-in-scale-service
      annotations:
        checksum/config: 4b3245c98480d806bcefeeea2890918ee4d272b2982c1f6fe0621fd323348231
    spec:
      hostAliases:
      ...
      containers:
        - name: plc-in-scale-service
          image: ...
          ports:
            - containerPort: 6203
          envFrom:
          - configMapRef:
              name: env-config-map-plc-in-scale-service
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: Always
          volumeMounts:
          - name: config-volume
            mountPath: /app/appsettings
      volumes:
        - name: config-volume
          configMap:
            name: appsettings-config-map-plc-in-scale-service
            items:
            - key: appsettings.XXX.json
              path: appsettings.Development.json
      nodeSelector:
        beta.kubernetes.io/os: linux
      schedulerName: default-scheduler
      imagePullSecrets:
      - name: ...
...
</code></pre>

<p>I believe this is due to automated health probes coming from Azure's load balancer. There is a GitHub issue requesting an annotation to control this behavior, but no solution from Microsoft as of yet.</p>
<p>See:
<a href="https://github.com/Azure/AKS/issues/1394" rel="nofollow noreferrer">https://github.com/Azure/AKS/issues/1394</a></p>
