Appearance
Load Balancers
Load Balancers in the Kubernetes Service platform are implemented by using KubeLB. KubeLB is a Kubermatic project that can manage Layer 4 and Layer 7 Load Balancers for Kubernetes clusters across various cloud and on-premise environments.
In the ESC Kubernetes Service it is used to manage Load Balancers for all clusters by providing Layer 4 TCP and UDP Load Balancers natively, and Layer 7 Load Balancers via Gateway API.
💡 Note
Load Balancer IP pools are configured during the environment onboarding.
Enabling Load Balancers in Clusters
To enable the Load Balancer functionality of the Kubernetes Service platform in a cluster, the option Kubermatic KubeLB must be enabled, either during creation of the cluster or afterwards when modifying a cluster in the UI: 
Layer 4 Load Balancers
TCP and UDP Load Balancers are supported out of the box by the ESC Kubernetes Service and can immediately be used once a cluster has been created.
Setting the Load Balancer class for KubeLB
While not strictly necessary it is nevertheless recommended to set the property spec.loadBalancerClass to kubelb whenever creating a LoadBalancer service.
Example:
yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
run: nginx
replicas: 1
template:
metadata:
labels:
run: nginx
spec:
containers:
- name: nginx
image: nginx:1.27-alpine
ports:
- containerPort: 80
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: nginx
spec:
type: LoadBalancer
loadBalancerClass: kubelb
selector:
run: nginx
ports:
- name: http
protocol: TCP
port: 8080
targetPort: 80Once applied the "nginx" service will automatically receive an EXTERNAL-IP based on the IP pool that was chosen during ESC Kubernetes Service environment creation.
Request a specific IP
The IP to be assigned to a service can also explicitely be requested as part of the service definition. This is done via the special annotation metallb.io/loadBalancerIPs see example:
⚠️ MetalLB annotations
The metallb.universe.tf are no longer supported and need to be replaced with metallb.io annotations!
yaml
---
apiVersion: v1
kind: Service
metadata:
name: nginx
annotations:
metallb.io/loadBalancerIPs: 1.2.3.4
spec:
type: LoadBalancer
loadBalancerClass: kubelb
selector:
run: nginx
ports:
- name: http
protocol: TCP
port: 8080
targetPort: 80Upstream documentation
Share an IP across services
yaml
---
apiVersion: v1
kind: Service
metadata:
name: nginx
annotations:
metallb.io/loadBalancerIPs: 172.100.202.10
metallb.io/allow-shared-ip: "my-secret-key"
spec:
type: LoadBalancer
loadBalancerClass: kubelb
selector:
run: nginx
ports:
- name: http
protocol: TCP
port: 8080
targetPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: sshd
annotations:
metallb.io/loadBalancerIPs: 172.100.202.10
metallb.io/allow-shared-ip: "my-secret-key"
spec:
type: LoadBalancer
loadBalancerClass: kubelb
selector:
run: sshd
ports:
- name: ssh
protocol: TCP
port: 2222
targetPort: 22⚠️ A note on externalTrafficPolicy
If you are sharing an IP between multiple services, these services must use the same externalTrafficPolicy, otherwise the IP will remain pending on one of them.
Upstream documentation
Reserve an IP
By setting an allow-shared-ip key value it is also possible to reserve an IP in advance, even when it is not (yet) being used. No other services will be able to request and assign the reserved IP unless they are matching the allow-shared-ip key value.
yaml
---
apiVersion: v1
kind: Service
metadata:
name: nginx
annotations:
metallb.io/loadBalancerIPs: 10.10.100.5
metallb.io/allow-shared-ip: "my-secret-key"
spec:
type: LoadBalancer
loadBalancerClass: kubelb
selector:
does-not-need-to-exist: "its-just-a-placeholder"
ports:
- port: 9001Layer 7 Load Balancers with Gateway API
KubeLB support for the Gateway API can be enabled during cluster creation by selecting the checkbox "Enable Gateway API": 
To use the Gateway API in a cluster the user will need to configure a Gateway CR to use the KubeLB Gateway Controller "kubelb". That Gateway Controller will be automatically provided and managed by the Kubernetes Service platform itself behind the scenes.
⚠️ Gateway API CRDs
If you enable the KubeLB based Gateway API the CRDs will be automatically installed and managed by the platform.
Overwritting the managed Gatewway API CRDs with your own, can break your cluster!
⚠️ Important
If you have specific requirements regarding performance or security sensitive applications, it is generally recommended to deploy your own Gateway API Controller instead of using the built-in, which will then be accessible through a normal Layer 4 LoadBalancer. The built-in Gateway API only allows minimal configuration and might not be suitable depending on the requirements.
Make sure to disable the "Enable Gateway API" checkbox if you want to use your own Gateway API controller, this will disable the built-in solution.
Recommendations for Gateway API controllers:
For more options, see Gateway API Implementations
Gateway
In order to use the Gateway API, first a Gateway will need to be configured in the cluster.
See the example configuration below:
yaml
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: kubelb
spec:
gatewayClassName: kubelb # important, gateway class must be "kubelb"
listeners:
- name: http
protocol: HTTP
port: 80
# allowedRoutes:
# namespaces:
# from: SameIt is important that spec.gatewayClassName matches "kubelb", as that is the Gateway Controller's name that the Kubernetes Service platform provides.
HTTPRoute
After the Gateway is ready and has been assigned an IP, then the user can now create a HTTPRoute to make use of the Gateway:
yaml
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: example
spec:
parentRefs:
- name: kubelb
hostnames:
- "www.example.com"
rules:
- backendRefs:
- name: nginx-example
kind: Service
port: 8080
# weight: 1
# matches:
# - path:
# type: PathPrefix
# value: /TLS Certificate
To configure a TLS Certificate for an HTTPRoute a KubeLB SyncSecret will need to be created. This secret is then automatically synced into the management layer of the Kubernetes Service platform and can be used by the Gateway to terminate TLS traffic.
For example:
yaml
---
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: example
spec:
gatewayClassName: kubelb
listeners:
- name: http
hostname: www.example.com
port: 443
protocol: HTTPS
tls:
mode: Terminate
certificateRefs:
- name: custom-certificate
---
kind: SyncSecret
apiVersion: kubelb.k8c.io/v1alpha1
metadata:
name: custom-certificate
type: kubernetes.io/tls
data:
tls.crt: ZnJhbmtsYW1wYXJkCg==
tls.key: ZnJhbmtsYW1wYXJkCg==Upstream documentation
https://docs.kubermatic.com/kubelb/v1.1/tutorials/security/cert-management/
⚠️ cert-manager using ACME issuer
There is a known issue where HTTPRoutes are not fully normalized by KubeLB, which breaks the acme-solver of cert-manager. Currently there is no known workaorund, and we are waiting for a bugfix in KubeLB.
Request a specific IP
The IP of a Gateway can also explicitely be requested in a similar way as with a LoadBalancer service (see above). This is done via the spec.infrastructure.annotations property on the Gateway CR, see example:
yaml
---
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: gateway-example
spec:
gatewayClassName: kubelb
listeners:
- name: http
protocol: HTTP
port: 8080
infrastructure:
annotations:
metallb.io/loadBalancerIPs: 1.2.3.4TLS and Cipher Suites
The built-in KubeLB Gateway API terminates TLS at the Envoy Proxy. Envoy uses BoringSSL and supports the following TLS versions and cipher suites by default:
TLS versions: TLS 1.2 and TLS 1.3
Default cipher suites (TLS 1.2):
| Cipher | Key Exchange | Authentication |
|---|---|---|
ECDHE-ECDSA-AES128-GCM-SHA256 | ECDHE | ECDSA |
ECDHE-ECDSA-CHACHA20-POLY1305 | ECDHE | ECDSA |
ECDHE-RSA-AES128-GCM-SHA256 | ECDHE | RSA |
ECDHE-RSA-CHACHA20-POLY1305 | ECDHE | RSA |
ECDHE-ECDSA-AES256-GCM-SHA384 | ECDHE | ECDSA |
ECDHE-RSA-AES256-GCM-SHA384 | ECDHE | RSA |
TLS 1.3 cipher suites are negotiated automatically by BoringSSL and cannot be individually configured.
Supported ECDH curves: X25519, P-256
⚠️ ClientTrafficPolicy with custom ciphers
If you configure a ClientTrafficPolicy with a set of ciphers defined, make sure you only use the ones listed above.
All other ciphers (for example DHE ciphers) are not supported!
Client IP Preservation
By default, the original client IP address is lost due to Source Network Address Translation (SNAT) that occurs as traffic passes through the load balancing infrastructure. KubeLB supports Proxy Protocol v2 to preserve the real client IP for Layer 4 (TCP) services.
How it works
Traffic flowing through KubeLB passes through multiple SNAT points before reaching the backend pod. Proxy Protocol v2 encodes the original client IP into a header that is prepended to the upstream TCP connection, allowing the backend to extract it.
Combined with externalTrafficPolicy: Local, which prevents kube-proxy from masquerading the source IP across node hops, this provides full end-to-end client IP preservation.
Configuration
Add the annotation kubelb.k8c.io/proxy-protocol: "v2" and set externalTrafficPolicy: Local on the Service:
yaml
apiVersion: v1
kind: Service
metadata:
name: my-tcp-service
annotations:
kubelb.k8c.io/proxy-protocol: "v2"
spec:
type: LoadBalancer
loadBalancerClass: kubelb
externalTrafficPolicy: Local
selector:
app: my-tcp-app
ports:
- name: tcp
protocol: TCP
port: 5000
targetPort: 5000⚠️ Backend MUST support Proxy Protocol!
The backend application must be configured to parse Proxy Protocol v2 headers. Sending Proxy Protocol headers to an application that does not expect them will cause connection failures or data corruption.
This is not a transparent feature — it requires explicit support on the receiving end.
Side effects and trade-offs
| Aspect | Effect |
|---|---|
externalTrafficPolicy: Local | Traffic is only routed to nodes running the target workload pod. Nodes without the pod are excluded from load balancer health checks. This reduces unnecessary health check traffic from the management cluster. |
| Backend without Proxy Protocol support | Connections will break. The Proxy Protocol header is raw bytes prepended to the TCP stream — non-PP-aware applications will interpret it as malformed data. |
| UDP services | Proxy Protocol is not available for UDP. There is no equivalent mechanism; the backend will see the Envoy pod IP as source. |
Layer 7 (HTTP) — X-Forwarded-For
For Layer 7 traffic routed through the built-in Gateway API (HTTPRoute), the client IP is automatically preserved via the X-Forwarded-For header. No additional configuration is needed — KubeLB's Envoy proxy appends the client IP to the XFF header by default.
Backend applications should read the first entry in the X-Forwarded-For header to obtain the original client IP.
Health Checks and Timeouts
KubeLB supports configuring Envoy's active health checks and connection timeouts via annotations on Service, Ingress, HTTPRoute, GRPCRoute, TCPRoute, and TLSRoute resources. This allows tenant users to tune load balancer behavior without requiring management-cluster access.
Upstream documentation
For the full set of configuration levels (Config, Tenant, Route/LoadBalancer CRDs) and in-depth explanations, see the official KubeLB docs:
Health Checks
By default, every TCP backend only receives a connect-only check (confirms a TCP connection can be established, not that the application is actually serving traffic). The following annotations allow switching to a tuned TCP, HTTP, or gRPC check:
| Annotation | Maps to | Default |
|---|---|---|
kubelb.k8c.io/health-check-type | Check type: TCP, HTTP, or GRPC | TCP |
kubelb.k8c.io/health-check-interval | Time between checks | 5s |
kubelb.k8c.io/health-check-timeout | Time to wait for a single check | 5s |
kubelb.k8c.io/health-check-healthy-threshold | Consecutive successes before marked healthy | 2 |
kubelb.k8c.io/health-check-unhealthy-threshold | Consecutive failures before marked unhealthy | 3 |
kubelb.k8c.io/health-check-http-path | Request path (only used when type: HTTP) | / |
kubelb.k8c.io/health-check-http-host | Host/authority header (only used when type: HTTP) | cluster name |
kubelb.k8c.io/health-check-http-expected-statuses | Comma-separated list of healthy status codes, e.g. 200,204 (only used when type: HTTP) | 200 |
kubelb.k8c.io/health-check-grpc-service | gRPC service name to check; empty checks overall server health (only used when type: GRPC) | empty |
kubelb.k8c.io/health-check-grpc-authority | :authority header (only used when type: GRPC) | cluster name |
yaml
apiVersion: v1
kind: Service
metadata:
name: web
annotations:
kubelb.k8c.io/health-check-type: HTTP
kubelb.k8c.io/health-check-http-path: /healthz
kubelb.k8c.io/health-check-http-expected-statuses: "200,204"
kubelb.k8c.io/health-check-interval: 10s
spec:
type: LoadBalancer
loadBalancerClass: kubelb
selector:
app: web
ports:
- port: 80
targetPort: 8080⚠️ Invalid HTTP checks fail closed
Active health checks cannot be disabled and have no fail-open behavior. An incorrect http-path or http-expected-statuses value will take the route to 0% healthy and all traffic will fail. UDP backends never receive health checks, as Envoy does not support them.
Timeouts
Default Envoy timeouts are tuned for short-lived REST traffic and may be too aggressive for streaming downloads, WebSockets/SSE, gRPC server-streaming, or slow-warming upstreams. The following annotations allow tuning timeouts per route:
| Annotation | Maps to | Default |
|---|---|---|
kubelb.k8c.io/timeout-request | Per-request timeout (Ingress, HTTPRoute, GRPCRoute) | 0s (disabled) |
kubelb.k8c.io/timeout-stream-idle | Stream idle timeout (Ingress, HTTPRoute, GRPCRoute) | 1h |
kubelb.k8c.io/timeout-request-headers | Time allowed to receive request headers (Ingress, HTTPRoute, GRPCRoute) | 0s (disabled) |
kubelb.k8c.io/timeout-idle-connection | HTTP connection idle timeout (Ingress, HTTPRoute, GRPCRoute) | 1h |
kubelb.k8c.io/timeout-tcp-idle | TCP idle timeout (TCPRoute, TLSRoute, L4 LoadBalancer) | 1h |
kubelb.k8c.io/timeout-connect | Upstream connect timeout (all routes and L4 LoadBalancer) | 5s |
Durations follow Go's time.ParseDuration format, e.g. 30s, 5m, 1h.
yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: object-storage
annotations:
kubelb.k8c.io/timeout-request: "0s"
kubelb.k8c.io/timeout-stream-idle: 6h
kubelb.k8c.io/timeout-idle-connection: 6h
spec:
rules:
- host: downloads.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: object-storage
port:
number: 80💡 0s disables the timeout
Setting a value to 0s does not mean "inherit the default", it explicitly disables that timeout, following Envoy semantics. Leave the annotation unset to use the default instead.
Invalid values are ignored
Invalid or negative duration values are silently ignored; the remaining valid annotations still apply.
Web Application Firewall
The ESC Kubernetes Service provides Web Application Firewall (WAF) capabilities for HTTPRoutes using the built-in KubeLB Gateway API. This WAF inspects Layer 7 HTTP traffic at the Envoy Proxy level and blocks malicious requests using the OWASP Core Rule Set (CRS) to protect against SQL injection, XSS, command injection and other common web attacks without requiring any application code changes.
⚠️ Beta Feature
WAF is currently a beta feature. It is suitable for non-critical production workloads.
💡 Supported Routes
WAF operates at Layer 7 only and applies only to HTTPRoute resources. It does not apply to Layer 4 LoadBalancer services, TCPRoutes, or UDPRoutes.
How it works
The ESC Kubernetes Service platform provides a pre-configured WAFPolicy called owasp-crs on the management cluster. This policy uses the OWASP Core Rule Set with default settings (blocking mode, 12.5 MB request body limit) and targets routes via a label selector. Users can opt-in to WAF protection for their HTTPRoutes by simply adding the matching label.
Enabling WAF on an HTTPRoute
To enable WAF protection on a route, add the label security.kubelb.io/waf: owasp-crs to the HTTPRoute resource:
yaml
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: my-app
labels:
security.kubelb.io/waf: owasp-crs # Enables WAF protection
spec:
parentRefs:
- name: kubelb
hostnames:
- "www.example.com"
rules:
- backendRefs:
- name: my-app-service
kind: Service
port: 8080Once the label is applied the platforms WAF policy then automatically takes effect on the route. All incoming HTTP requests to that route will be inspected against the OWASP Core Rule Set before being forwarded to defined backend service.
What is blocked?
The OWASP CRS provides battle-tested rules that detect and block common web attack patterns, including:
- SQL Injection (SQLi)
- Cross-Site Scripting (XSS)
- Remote Code Execution / Command Injection
- Local/Remote File Inclusion (LFI/RFI)
- HTTP Protocol Violations
- Scanner/Bot Detection
Blocked requests receive an HTTP 403 Forbidden response and never reach the backend application.
Verifying WAF protection
The user can test that the WAF is active on a route by sending a request that contains a common SQL injection pattern:
bash
curl -I "https://www.example.com/?id=1+OR+1=1"If the WAF is active then this request will be blocked and return a 403 status code.
Removing WAF protection
Simply remove the label from the HTTPRoute to disable the WAF again.
Policy update behavior
When the WAF label is added or removed from an HTTPRoute, the change is propagated to the Envoy Proxy immediately. However existing HTTP/2 and keep-alive connections might continue using the previous configuration until they close naturally. New connections will immediately use the updated WAF state.
