How to Configure Advanced Load Balancer Settings in Kubernetes Clusters Limited Availability

Kubernetes is currently in limited availability. Learn more.

The DigitalOcean Cloud Controller supports provisioning DigitalOcean Load Balancers in a cluster’s resource configuration file. You can specify the following advanced settings in the metadata stanza of your configuration file under annotations:

  • Algorithm
  • Sticky sessions
  • Health checks
  • Forced SSL connections


By default, the load balancer splits connections evenly across the backend using the round-robin protocol. The least connections algorithm will route traffic to the backend worker node with the fewest number of open connections.

Use round_robin instead of least_connections to explicitly specify the default setting.

. . .
  name: least-connections-snippet
  annotations: "least_connections"
. . .

See a full configuration example for least connections.

Sticky Sessions

By default, the load balancer routes each client request to the backend following the configured algorithm. When you enable sticky sessions, the load balancer will route a client’s initial request to a worker node and use a cookie to route its follow-up requests to that same node.

Use none instead of cookies to explicitly specify the default setting.

  name: sticky-session-snippet
  annotations: "cookies" "example" "60"

See a full configuration example for sticky sessions.

Health Checks

By default, the load balancer peforms health checks on the worker nodes over HTTP on port 80 at the webserver root.

You can change both the protocol and path in the metadata stanza’s annotations section.

  name: health-check-snippet
  annotations: "http" "/health"

See full configuration examples for the health check path and health check protocol

Forced SSL Connections

If you configure at least one HTTP and one HTTPS rule, you can force the load balancer to redirect all HTTP requests to HTTPS. The example below contains the configuration settings that must be true for the redirect to work.

. . .
  name: https-with-redirect-snippet
  annotations: "http" "round_robin" "443" "your-certificate-id" "true"
. . .

See the full configuration example for forced SSL connections.


For more about managing load balancers, see: