HA, Failover, Replication

Dear friends!

Could you please explain me: how

  • HA,
  • Failover,
    work in LXD? And do these features are available?

For example, as I understand it supposed to work: like in Swarm/k8s cluster there is an option to replicate running containers on cluster nodes. Thus in term of Failover, the running service will never fail.

In a LXD cluster HA/Failover/Replication are all properties of LXD itself, not of the containers being run. For example if a particular node gets rebooted or goes down, the cluster as a whole continues to work (e.g. you can list containers, start new containers etc), although operations targeted on containers of the node that went offline won’t work until the node comes back.

There’s no automatic failover for containers, however if you use ceph for your storage pool, then the rootfs image of a container running of a node that goes down will be available on other nodes too, and you can immediately move and restart that container on an online node. This can be scripted as per your own policy.

Alright, it’clear. Thanks a lot!
But what about service replication? I mean, when the copies of one container are located among the whole cluster, cluster nodes. But they all work in a “hot stand-by mode” (like k8s does).

I’m not sure what you mean. In a LXD cluster a container belongs to one and only one node. You can create a copy of it and run it on a different node, but they will become two different containers. Ceph just allows you to have the rootfs of one container available on any node (since ceph is a replicated data store): you still have to indicate which node “owns” the container, but as I said in case the node that currently own the container goes away you can transfer the “ownership” to another node and start the container again in that node very quickly.

Kubernetes model is completely different, as containers are mostly stateless and you can start start many of them from the same image.

You should think at LXD containers as OS-level “virtual machines”. Basically LXD clustering is similar to VMWare’s vSphere (but you get way more density with LXD), and not to Kubernetes.