HAcluster
HAcluster is a Juju subordinate charm that encapsulates corosync and pacemaker for floating virtual IP or DNS addresses and is similar to keepalived. It differentiates itself in that it allows servers to span subnets via the DNS option, which communicates directly with MAAS. It also has the ability to shoot the other node in the head(STONITH) via MAAS to prevent issues in a split-brain scenario.
Charmed Kubernetes supports HAcluster via a relation and the
configuration options ha-cluster-vip
and ha-cluster-dns
. Relations to the
kubernetes-control-plane and kubeapi-load-balancer charms are supported. These options
are mutually exclusive.
Deploying
In order to use HAcluster, the first decision is if a load balancer is desired. This depends on the size of the cluster and the expected control plane load. Note that it is recommended to run HAcluster on a minimum of 3 units for a reliable quorum, so you will need 3 kubeapi-load-balancer or 3 kubernetes-control-plane units to use HAcluster.
With Load Balancer
juju deploy charmed-kubernetes
juju add-unit -n 2 kubeapi-load-balancer
juju deploy hacluster
juju config kubeapi-load-balancer ha-cluster-vip="192.168.0.1 192.168.0.2"
juju relate kubeapi-load-balancer hacluster
Without Load Balancer
juju deploy kubernetes-core
juju add-unit -n 2 kubernetes-control-plane
juju deploy hacluster
juju config kubernetes-control-plane ha-cluster-vip="192.168.0.1 192.168.0.2"
juju relate kubernetes-control-plane hacluster
Validation
Once things settle, the virtual IP addresses should be pingable. A new kubeconfig file will be created containing the virtual IP addresses. You will need to replace your kubeconfig with the new one:
juju scp kubernetes-control-plane/0:config ~/.kube/config