Creating a k3s cluster with hostname instead of ip address

76 Views Asked by At

How should I be configuring my cluster so that they can address each other using their hostnames instead of ip addresses so it can be deployed in an environment where ip addresses can change?

My home network is set up with "lan" as the local domain. So if my Raspberry Pi has hostname "foo", I can connect to it via "foo.lan". I noticed that that cluster falls apart if the ip address for any of my nodes changes, so I've had to assign static ip's in my router's settings.

Startup command for my primary server: k3s server --cluster-init --data-dir /var/lib/rancher/k3s --token [redacted] --disable=traefik --disable=servicelb --disable-cloud-controller --flannel-backend=wireguard-native --node-name=foo0.lan

Startup command for my other server: k3s server --data-dir /var/lib/rancher/k3s --server https://foo0.lan:6443 --token [redacted] --disable=traefik --disable=servicelb --disable-cloud-controller --flannel-backend=wireguard-native --node-name=foo1.lan

I tried changing the ip address of my nodes expecting the k3s cluster to continue working but the cluster became non-responsive.

0

There are 0 best solutions below