Report this

What is the reason for this report?

How enable backend Keepalive using TCP from LoadBalancer kubernentes?

Posted on August 9, 2020

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

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/do-loadbalancer-enable-proxy-protocol: "true"
    # service.beta.kubernetes.io/do-loadbalancer-enable-backend-keepalive: "true"
  labels:
    helm.sh/chart: ingress-nginx-2.11.1
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/version: 0.34.1
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: controller
  name: ingress-nginx-controller
  namespace: ingress-nginx
spec:
  type: LoadBalancer
  externalTrafficPolicy: Local
  ports:
    - name: http
      port: 80
      protocol: TCP
      targetPort: http
    - name: https
      port: 443
      protocol: TCP
      targetPort: https
  selector:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/component: 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?



This textbox defaults to using Markdown to format your 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:

https://github.com/digitalocean/digitalocean-cloud-controller-manager/blob/master/docs/controllers/services/annotations.md#servicebetakubernetesiodo-loadbalancer-protocol

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

Regards,

John

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.