Skip to content

Use LoadBalancer IPv6 address #1218

@Djokkum

Description

@Djokkum

/kind feature

Describe the solution you'd like
Currently, the Kubernetes API server endpoint is always set to the load balancer's IPv4 address. I'm setting up a Hetzner cluster with IPv6-only nodes and a private network; all incoming traffic would be handled by Hetzner load balancers. As the API server endpoint is set to an IPv4 address, nodes cannot reach the API server after kubeadm initialization (dial tcp 167.xxx.xxx.xxx: connect: network is unreachable).

As far as I can tell, a pure IPv6 setup is currently not possible without manually configuring a load balancer and DNS so a hostname can be used for spec.controlPlaneEndpoint.host in the HetznerCluster manifest.

Looking at the code that determines the endpoint, I think it should be possible to add a property to the controlPlaneLoadBalancer object (e.g. useV6Endpoint). If this property were set to true, the control plane endpoint would be set to the LB's IPv6 address instead of the IPv4 one in the code section below:

func processControlPlaneEndpoint(hetznerCluster *infrav1.HetznerCluster) {
if hetznerCluster.Spec.ControlPlaneLoadBalancer.Enabled {
if hetznerCluster.Status.ControlPlaneLoadBalancer.IPv4 != "<nil>" {
defaultHost := hetznerCluster.Status.ControlPlaneLoadBalancer.IPv4
defaultPort := int32(hetznerCluster.Spec.ControlPlaneLoadBalancer.Port)
if hetznerCluster.Spec.ControlPlaneEndpoint == nil {
hetznerCluster.Spec.ControlPlaneEndpoint = &clusterv1.APIEndpoint{
Host: defaultHost,
Port: defaultPort,
}
} else {
if hetznerCluster.Spec.ControlPlaneEndpoint.Host == "" {
hetznerCluster.Spec.ControlPlaneEndpoint.Host = defaultHost
}
if hetznerCluster.Spec.ControlPlaneEndpoint.Port == 0 {
hetznerCluster.Spec.ControlPlaneEndpoint.Port = defaultPort
}
}
conditions.MarkTrue(hetznerCluster, infrav1.ControlPlaneEndpointSetCondition)
hetznerCluster.Status.Ready = true
} else {

Please let me know what you think, I'd be happy to contribute a PR if this seems feasible/desirable.

Anything else you would like to add:
Related issues: #632, #899

Environment:

  • cluster-api-provider-hetzner version: v1.0.0-beta.29
  • Kubernetes version: 1.29.1
  • OS (e.g. from /etc/os-release): ubuntu-22.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions