Skip to content

Conversation

@aslafy-z
Copy link

@aslafy-z aslafy-z commented Nov 27, 2025

Description

This PR extends the service.beta.kubernetes.io/scw-loadbalancer-health-check-port annotation (introduced in #195) with support for automatic detection of Kubernetes' healthCheckNodePort.

Problem

When using externalTrafficPolicy: Local, kube-proxy (or cilium) allocates a dedicated spec.healthCheckNodePort on each node specifically for load balancer health probes. While #195 added the ability to manually specify a health check port, users still had to look up and hardcode the healthCheckNodePort value.

Fixes #192
Depends on #195

Solution

Added support for the special value "auto" which:

  • When externalTrafficPolicy: Local and spec.healthCheckNodePort is set → uses healthCheckNodePort
  • Otherwise → falls back to nodePort (default behavior)

This aligns with native Kubernetes LoadBalancer health check behavior and enables seamless client source IP preservation.

Example Usage

apiVersion: v1
kind: Service
metadata:
  name: my-service
  annotations:
    # Automatic detection: uses healthCheckNodePort when available
    service.beta.kubernetes.io/scw-loadbalancer-health-check-port: "auto"
spec:
  type: LoadBalancer
  externalTrafficPolicy: Local 
  ports:
    - port: 80
      targetPort: 8080

Per-port configuration is also supported:

service.beta.kubernetes.io/scw-loadbalancer-health-check-port: "80:auto;443:31234"

Future Work

In the next major release, "auto" will become the default behavior.

Signed-off-by: Zadkiel AHARONIAN <hello@zadkiel.fr>
@aslafy-z aslafy-z changed the title feat(loadbalancer): add health check port annotation feat(loadbalancer): add healthCheckNodePort opt-in support Nov 27, 2025
Signed-off-by: Zadkiel AHARONIAN <hello@zadkiel.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Support dynamic healthCheckNodePort for LoadBalancers

1 participant