3

I am new to the Kubernetes and cluster.

I would like to bring up an High Availability Master Only Kubernetes Cluster(Need Not to!).

I have the 2 Instances/Servers running Kubernetes daemon, and running different kind of pods on both the Nodes.

Now I would like to somehow create the cluster and if the one of the host(2) down, then all the pods from that host(2) should move to the another host(1).

once the host(2) comes up. the pods should float back.

Please let me know if there is any way i can achieve this?

user1830237
  • 41
  • 1
  • 1
  • 4
  • One workaround is to run all your pods as DaemonSets instead of as Deployments. That way they run on both servers and are available even if one service is down. – Marc Mar 09 '22 at 09:31

2 Answers2

3

Since your requirement is to have a 2 node master-only cluster and also have HA capabilities then unfortunately there is no straightforward way to achieve it.

Reason being that a 2 node master-only cluster deployed by kubeadm has only 2 etcd pods (one on each node). This gives you no fault tolerance. Meaning if one of the nodes goes down, etcd cluster would lose quorum and the remaining k8s master won't be able to operate.

Now, if you were ok with having an external etcd cluster where you can maintain an odd number of etcd members then yes, you can have a 2 node k8s cluster and still have HA capabilities.

  • 3
    Could you elaborate on "quorum"? Surely if one master node disappears, the other notes it is the only node (a majority of 1) and is able to function? – Marc Mar 09 '22 at 07:50
  • This doc might be helpful: https://etcd.io/docs/v3.3/faq/. It seems that a cluster *could* be operational with 1-2 master nodes but there's no fault tolerance so it's not really HA. – TastyWheat May 20 '23 at 16:00
0

It is possible that master node serves also as a worker node however it is not advisable on production environments, mainly for performance reasons.

By default, kubeadm configures master node so that no workload can be run on it and only regular nodes, added later would be able to handle it. But you can easily override this default behaviour.

In order to enable workload to be scheduled also on master node you need to remove from it the following taint, which is added by default:

kubectl taint nodes --all node-role.kubernetes.io/master-

To install and configure multi-master kubernetes cluster you can follow this tutorial. It describes scenario with 3 master nodes but you can easily customize it to your needs.

mario
  • 9,858
  • 1
  • 26
  • 42
  • Thanks Mario for the information. Is it possible to create 2 Master only nodes? – user1830237 Aug 06 '19 at 05:17
  • Yes, theoretically it should be available however I've never done that. You can try to configure it e.g. using above mentioned tutorial but without setting up any additional worker nodes and remove mentioned taint from both masters so the workload can be scheduled on them. – mario Aug 06 '19 at 10:51