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?

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.

×
1 answer

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

Submit an Answer