Configuring a Hetzner Load Balancer

Example usage

In order to expose your workload with a Service of type Load Balancer, you need to annotate the Service so it is able to correctly assign IPs to the pods:

Annotation key Explanation
load-balancer.hetzner.cloud/location Should match the region set on the Cluster resource
load-balancer.hetzner.cloud/type Should match the type set on the Cluster resource

Below you can find an example manifest exposing a web server with a Service of type Load Balancer:

yaml
apiVersion: v1 kind: Service metadata: creationTimestamp: null labels: run: test-loadbalancer name: test-loadbalancer annotations: // [!code tooltip:fsn1:1:Should match the region set on the Cluster resource] load-balancer.hetzner.cloud/location: fsn1 // [!code tooltip:lb11:1:Should match the type set on the Cluster resource] load-balancer.hetzner.cloud/type: lb11 spec: ports: - port: 80 protocol: TCP targetPort: 80 selector: run: test-loadbalancer type: LoadBalancer --- apiVersion: v1 kind: Pod metadata: labels: run: test-loadbalancer name: test-loadbalancer spec: containers: - image: nginx name: test-loadbalancer dnsPolicy: ClusterFirst restartPolicy: Always

You should be able to see the External IP assigned to your service and access nginx through it.

Previous
Self-managed GitOps
Next
Pod and service subnet configuration