I haven't yet seen any guides for deploying multi master highly available Kubernetes cluster v1.28. So I decided to make one by myself. Feel free to comment and ask questions, I'll do my best to help. Let's begin though.
Prerequisites
This approach of making a multi master node cluster based on idea of 3-node cluster, assuming that 1 master-node can fail, the other 2 nodes can normally make next control decisions by bigger part, since they are 2 and more than 1. That's why not 4 nodes or more. Also if we have more than 3 nodes, it will took much more time for active nodes to make control decisions.
Ok, our setup will have 1 node with HA Proxy on it. This will balance traffic by distributing it between master nodes. Next we put 3 master nodes, which in terms of Kubernetes called "control planes". And 3 worker nodes for doing their work. I have put all of this on my scheme.
Virtual machines
Every machine here will be 2CPU, 2Gb RAM, 20 Gb SSD NVMe. This is enough for now as we are testing installation procedures. Every virtual machine parameter can be changed then. LAN is the same for all machines. We installed there Linux Ubuntu Server 22.04.3 in minimised version, then obtained IP address and updated software to last versions. Now we are ready to start setting up our Kubernetes 1.28 cluster.
HA Proxy
First stage of cluster will be served by HA Proxy machine. It will take all traffic and distribute it evenly across all master nodes. Connect to your HA Proxy machine.
ssh <username>@<ha.proxy.ip.address>
To be able to edit config files, let's install best editor in the world:
sudo apt install vim -y
Let's install HA Proxy:
sudo apt install haproxy -y
When installed, we can configure it for our needs. Open HA Proxy config:
sudo vim /etc/haproxy/haproxy.cfg
When you see file opened press "i" button to put your vim into insert mode, you will see "---INSERT---" in the bottom left corner of connected terminal. And let's add here next lines:
frontend k8s-cluster
bind <HA Proxy machine IP>:6443
option tcplog
mode tcp
default_backend k8s-control-planes
To get HA Proxy IP execute "ip a" in connected terminal. This part means, we set load balancer to listen inbound traffic and redirect in to control planes.
And after that add:
backend k8s-control-planes
mode tcp
balance roundrobin
option tcp-check
server <Master node 1 hostname> <Master node 1 IP>:6443 check fall 3 rise 2
server <Master node 2 hostname> <Master node 2 IP>:6443 check fall 3 rise 2
server <Master node 3 hostname> <Master node 3 IP>:6443 check fall 3 rise 2
To get hostnames of your master nodes, execute "cat /etc/hostname" in their terminals. This part means, we just spread traffic on port 6443 evenly (balance roundrobin) across mentioned nodes. After you have pasted this into haproxy.cfg, press ESC button to exit from the insert mode. Now press ":", "w", "q" to save changes and exit.
Finally restart haproxy for changes to take effect.
sudo systemctl restart haproxy
That's it. See you on the next parts, where we will install container runtime, Kubernetes 1.28 and initialise cluster.