Skip to content

Latest commit

 

History

History
206 lines (162 loc) · 5.27 KB

File metadata and controls

206 lines (162 loc) · 5.27 KB

LoadBalancer Services Configuration

Overview

The CCM supports two types of LoadBalancer implementations:

  1. Linode NodeBalancers (default)
  2. BGP-based IP sharing

For implementation examples, see Basic Service Examples.

NodeBalancer Implementation

When using NodeBalancers, the CCM automatically:

  1. Creates and configures a NodeBalancer
  2. Sets up backend nodes
  3. Manages health checks
  4. Handles SSL/TLS configuration

For more details, see Linode NodeBalancer Documentation.

Basic Configuration

Create a LoadBalancer service:

apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  type: LoadBalancer
  ports:
    - port: 80
      targetPort: 8080
  selector:
    app: my-app

See Advanced Configuration Examples for more complex setups.

NodeBalancer Settings

Protocol Configuration

Available protocols:

  • tcp (default)
  • http
  • https

Set the default protocol:

metadata:
  annotations:
    service.beta.kubernetes.io/linode-loadbalancer-default-protocol: "http"

See Service Annotations for all protocol options.

Health Checks

Configure health checks using annotations:

metadata:
  annotations:
    service.beta.kubernetes.io/linode-loadbalancer-check-type: "http"
    service.beta.kubernetes.io/linode-loadbalancer-check-path: "/healthz"
    service.beta.kubernetes.io/linode-loadbalancer-check-interval: "5"
    service.beta.kubernetes.io/linode-loadbalancer-check-timeout: "3"
    service.beta.kubernetes.io/linode-loadbalancer-check-attempts: "2"

Available check types:

  • none: No health check
  • connection: TCP connection check
  • http: HTTP status check
  • http_body: HTTP response body check

For more details, see Health Check Configuration.

SSL/TLS Configuration

  1. Create a TLS secret:
apiVersion: v1
kind: Secret
metadata:
  name: my-tls-secret
type: kubernetes.io/tls
data:
  tls.crt: <base64-encoded-cert>
  tls.key: <base64-encoded-key>
  1. Reference in service annotation:
metadata:
  annotations:
    service.beta.kubernetes.io/linode-loadbalancer-port-443: |
      {
        "protocol": "https",
        "tls-secret-name": "my-tls-secret"
      }

Connection Throttling

Limit connections from the same client IP:

metadata:
  annotations:
    service.beta.kubernetes.io/linode-loadbalancer-throttle: "5"

Proxy Protocol

Enable proxy protocol for client IP preservation:

metadata:
  annotations:
    service.beta.kubernetes.io/linode-loadbalancer-default-proxy-protocol: "v2"

BGP-based IP Sharing Implementation

BGP-based IP sharing provides a more cost-effective solution for multiple LoadBalancer services. For detailed setup instructions, see Cilium BGP Documentation.

Prerequisites

  • Cilium CNI with BGP control plane enabled
  • Additional IP provisioning enabled on your account (contact Linode Support)
  • Nodes labeled for BGP peering

Configuration

  1. Enable BGP in CCM deployment:
args:
  - --load-balancer-type=cilium-bgp
  - --bgp-node-selector=cilium-bgp-peering=true
  - --ip-holder-suffix=mycluster
  1. Label nodes that should participate in BGP peering:
kubectl label node my-node cilium-bgp-peering=true
  1. Create LoadBalancer services as normal - the CCM will automatically use BGP-based IP sharing instead of creating NodeBalancers.

Environment Variables

  • BGP_CUSTOM_ID_MAP: Use your own map instead of default region map for BGP
  • BGP_PEER_PREFIX: Use your own BGP peer prefix instead of default one

For more details, see Environment Variables.

Advanced Configuration

Using Existing NodeBalancers

Specify an existing NodeBalancer:

metadata:
  annotations:
    service.beta.kubernetes.io/linode-loadbalancer-nodebalancer-id: "12345"

NodeBalancer Preservation

Prevent NodeBalancer deletion when service is deleted:

metadata:
  annotations:
    service.beta.kubernetes.io/linode-loadbalancer-preserve: "true"

Port Configuration

Configure individual ports:

metadata:
  annotations:
    service.beta.kubernetes.io/linode-loadbalancer-port-443: |
      {
        "protocol": "https",
        "tls-secret-name": "my-tls-secret",
        "proxy-protocol": "v2"
      }

Tags

Add tags to NodeBalancer:

metadata:
  annotations:
    service.beta.kubernetes.io/linode-loadbalancer-tags: "production,web-tier"

Related Documentation