Remote Access of HA Cluster

My set up is a 3 nodes HA cluster on raspberry Pi 4b. And I run kubectl on my MacBook in the same LAN.
The problem is that if the master node I’m connecting to failed, I can’t run kubectl from my MacBook unless I change the cluster IP in ~/.kube/config to the IP of another master node. Is there a way to fix this? Thanks in advance.

In that case you need some form of load balancer in front. And you will need to add the LB’s IP address and add it to the file /var/snap/microk8s/current/certs/csr.conf.template in the IP. section. This way the certs generated will include the IP address of your LB.

Once you have the .kube/config file, you can just replace whatever IP address there with the IP address of the LB
Atleast that is how i do it.

What load balancer do you use? It seems like Metallb can’t be used for this purpose.
Can I use Kube-VIP for that?

Good question. I usually use the cloud provider’s LB. I heard some use keepalive.