How enable backend Keepalive using TCP from LoadBalancer kubernentes?

Hi, I’m trying to enable keep-alive support from a LoadBalancer for an Ingress Controller in kubernetes:

apiVersion: v1
kind: Service
  annotations: "true"
    # "true"
  labels: ingress-nginx-2.11.1 ingress-nginx ingress-nginx 0.34.1 Helm controller
  name: ingress-nginx-controller
  namespace: ingress-nginx
  type: LoadBalancer
  externalTrafficPolicy: Local
    - name: http
      port: 80
      protocol: TCP
      targetPort: http
    - name: https
      port: 443
      protocol: TCP
      targetPort: https
  selector: ingress-nginx ingress-nginx controller

The issue is that KeepAlive is only available for “HTTP” forwarding rule, ending with this error:

Backend keepalive requires at least one forwarding rule with HTTP or HTTPS target protocol.

BUT ports only support “TCP”, “UDP”, and “SCTP” protocols. Default is TCP.

So, how get this enable?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there!

This protocol is talking about forwarding rules. Therefore, this should work for you if you implement an annotation like this:

Setting this value to http or https should get this going.