Replies: 3 comments 9 replies
-
Thanks for looking into this. To be honest I haven't seen a case where I ever needed to disable ipv4 because at this point in time it can still translate into hassle for a number of things. Besides saving on the cost of IPv4 addresses, what is the use case? |
Beta Was this translation helpful? Give feedback.
-
It's mostly "preparedness" - i.e., I think we should be forward-thinking and stop using public IPv4 addresses where we can. A Kubernetes cluster is the perfect example where public IPv4 addresses shouldn't be necessary. I've even built a few "pure IPv6" clusters, and it's very interesting: pods get public IPv6 addresses, and all services are automatically public-facing because the Cluster IP CIDR is a public IPv6 block. Also, when I saw that there were options to disable IPv4 public addresses, I thought "whoa, hetzner-k3s supports this, that's awesome" so I wanted to test it. After trying it, I wonder if anyone is actually using that option; perhaps we should add something in the README/doc to warn people that it doesn't work out of the box 😅 |
Beta Was this translation helpful? Give feedback.
-
What about without both Ipv4 and ipv6? And using a gateway for security reasons? |
Beta Was this translation helpful? Give feedback.
-
In theory, it should be possible to deploy a Kubernetes cluster without public IPv4 addresses. There would be no significant loss of functionality for the users, since the API server is exposed with a load balancer; and public-facing services running inside the Kubernetes cluster could be exposed with
type: LoadBalancer
.In practice, there are multiple issues to address if we want to achieve that with
hetzner-k3s
.I'm sharing my experimentations and thoughts here in case that's helpful to others.
1. Connecting to the nodes
hetzner-k3s
executes the provisioning by connecting to the nodes over SSH. As of April 2024, it uses the public IPv4 address of the nodes, and if the nodes don't have a public IPv4 address, it falls back to their private address. This only works ifhetzner-k3s
is executed on a machine connected to the same Hetzner Private Network as the cluster nodes. I imagine that it might be possible to create the Private Network ahead of time; create a Hetzner VM there; and runhetzner-k3s
from that machine; but I didn't try (I wanted to be able to provision clusters from my local machine).The idea would be to do the provisioning over IPv6. Of course, it requires to have a machine with IPv6 connectivity; the rest of this document assumes that you have IPv6 connectivity. It's the case with all the ISP I've used in the last 5+ years in France, Germany, and the US. It might not be the case when connecting from hotels, conferences, hotspots, etc., though.
I patched
hetzner-k3s
so that when there is no public IPv4 address, it falls back to the public IPv6 address (and if there is no public address at all, it falls back to the private IPv4 address, like before). The patch is available in my ipv6-WIP branch - but it's not enough to solve the problem.2. Determining the public IP address
Currently, the public IP address is determined with
hostname -I
- more precisely,PUBLIC_IP=$(hostname -I | awk '{print $1}')
. This gives the first IPv4 address found on the machine. When the nodes have a public IPv4 address, it yields the correct result; but when the nodes don't have a public IPv4 address, it yield an address in the carrier-grade private IP space (10.64.0.0/10).There are multiple possibilities to find out the public IPv6 address; for instance,
PUBLIC_IP=$(hostname -I | awk '{print $3}')
seems to work (but it might break if Hetzner changes the way their configure their VMs).3. Downloading k3s
When Hetzner machines don't have a public IPv4 address, they can't access external servers that have IPv4-only connectivity. And, unfortunately,
github.com
is V4-only. So when the k3s install script tries to download k3s hashes or k3s binaries, that fails.I'm stuck at this point. I could imagine the following solutions:
sed
) to updategit.luolix.top
URLs with a mirror that would be reachable on IPv6None of these solutions is truly satisfactory. The "least worst" might be the dual stack gateway/proxy, but if someone has a better idea, let me know :)
4. ??? (the unknown unknowns!)
After we find a way to download k3s, we'll probably run into other issues (maybe with Flannel or otherwise). I have experience running full-IPv6 clusters on Linode with Cilium, so I'm hopeful; but we'll see :)
Beta Was this translation helpful? Give feedback.
All reactions