How to setup a k8s cluster with only ipv6?

how to setup a k8s cluster with only ipv6? Using kubeadm init fails when controlPlaneEndpoint configured IPv6 address, configration file kubeadm-config-ipv6.yaml following as:

---
apiVersion: kubeadm.k8s.io/v1beta3
kind: ClusterConfiguration
kubernetesVersion: v1.25.11
controlPlaneEndpoint: [fd00:0:0:1003::100]:6443
networking:
  podSubnet: 2001:db8:42:0::/56
  serviceSubnet: 2001:db8:42:1::/112
---
apiVersion: kubeadm.k8s.io/v1beta3
kind: InitConfiguration
localAPIEndpoint:
  advertiseAddress: "fd00:0:0:1003::1004"
  bindPort: 6443
nodeRegistration:
  kubeletExtraArgs:
    node-ip: fd00:0:0:1003::1004
---
kind: KubeletConfiguration
apiVersion: kubelet.config.k8s.io/v1beta1
cgroupDriver: systemd

Setting up a Kubernetes (k8s) cluster with only IPv6 involves using kubeadm with a specific configuration tailored for IPv6 networking. Here’s a concise guide:

  1. Prepare your configuration: Ensure your kubeadm-config-ipv6.yaml file specifies the IPv6 addresses for controlPlaneEndpoint, podSubnet, serviceSubnet, and advertiseAddress. The configuration you provided looks appropriate for an IPv6 setup.
  2. Apply the configuration: Initialize the cluster with the command kubeadm init --config kubeadm-config-ipv6.yaml. This will use your IPv6 configurations for setting up the control plane and other components.
  3. Troubleshoot: If kubeadm init fails, check for error messages in the output. Common issues may involve misconfigurations in the YAML file, networking restrictions, or IPv6 support on your network and nodes.

Ensure that your network infrastructure and all nodes in the cluster fully support IPv6.

Maybe controlPlaneEndpoint only support IPv4 ?

When using a kubeadm with a configuration file, you’ll get an error when you set the controlPlaneEndpoint to an IPv6 address. There is a work-a-round. Where you can add an entry in your hosts file and set that to the IPv6 address. Then use the hostname in your kubeadm init config. This also will allow you to change your setup to a Highly Available control-plane cluster if you so choose.

For example, update the /etc/hostsfile:

echo “fd00:0:0:1003::100  control-plane” | sudo tee -a /etc/hosts

Then use control-plane as your endpoint.

See Considerations about apiserver-advertise-address and ControlPlaneEndpoint for more details.

You’ll have to update all /etc/hosts file on ever node added to your cluster to point to the correct IP.