gyptazy / ProxLB

ProxLB - (Re)Balance VM Workloads Across Nodes in Proxmox Clusters. A Load Balancer for Proxmox - and more!
https://proxlb.de
GNU General Public License v3.0
201 stars 9 forks source link

`Feature`: host groups - honour HA groups #65

Open antitbone opened 2 months ago

antitbone commented 2 months ago

Hello

Is it planned to implement cluster management on multiple computer rooms?

It would be interesting to be able to define host groups and limit the migration of VMs to host groups. This will allow the distribution of vms over several computer rooms so that the hosted services can withstand the loss of a room. And have a degraded mode in which host groups are not respected if one of the host groups is not available.

Example with a ceph stretch cluster on Two computer rooms + a witness. Only the compute is to be migrated If the cluster is correctly sized it is possible to survive the loss of a computer room.

Antoine

gyptazy commented 2 months ago

Hey @antitbone,

thanks for your input. When I initially integrated the affinity / anti-affinity rules I also thought about something like that. However, it's not really possible to do it in a user friendly way. While we have tags for VMs, we only have notes fields for nodes. This means, this could be abused in a dirty way, or something like an additional matrix in YAML or JSON could be provided which might look like:

group1:
  nodes:
    - node01
    - node02
    - node03
  vms:
    - vm01
    - vm02
    - vm03
group2:
  nodes:
    - node04
    - node05
    - node06
  vms:
    - vm04
    - vm05
    - vm06

or

{
  "group1": {
    "nodes": [
      "node01",
      "node02",
      "node03"
    ],
    "vms": [
      "vm01",
      "vm02",
      "vm03"
    ]
  },
  "group2": {
    "nodes": [
      "node04",
      "node05",
      "node06"
    ],
    "vms": [
      "vm04",
      "vm05",
      "vm06"
    ]
  }
}

So, from a technical perspective this isn't difficult but I'm not sure which way could be the best one for a user to provide the information / matrix. Happy to hear feedback!

Cheers, gyptazy

antitbone commented 2 months ago

It does not seem possible to have tags at the host level in proxmox. Host groups in an external file make sense. Especially since the topology of the hosts moves little in time.

group1:
  nodes:
    - node01
    - node02
    - node03
group2:
  nodes:
    - node04
    - node05
    - node06

But the assignment of vm to a group could be done by a tag. ex: pbl_group-preferred_group1, pbl_group-exclusive_group1

Antoine

gyptazy commented 2 months ago

Hey Antonie,

right, but this is already included in Proxmox: https://github.com/gyptazy/ProxLB?tab=readme-ov-file#affinity-stay-together

However, this only keeps the VMs together but does not have any correlation to the nodes on this level. So they might still be moved to completely different "rooms" or "places.

Cheers, gyptazy

antitbone commented 2 months ago

Do the currently possible tags respect ha groups?

Antoine

gyptazy commented 2 months ago

Do the currently possible tags respect ha groups?

No, they don't do it yet.

antitbone commented 2 months ago

This would solve the problem of placing VMs on a stretched cluster.

cobyteskb commented 2 months ago

+1 I like to use this to pin Windows vms to specific hosts due to licensing (we license physical hosts) with HA-rules, and then use the tag exclude rules to make sure they are not running on the same host.