Skip to main content
RunBook Academy

Proxmox VEXII · High AvailabilityHA rules

HA rules: node-affinity (PVE 9)

Advanced⏱ ~24 minha-manager

What you'll learn

  • Create HA node affinity rules for resource placement
  • Apply positive and negative affinity
  • Distinguish strict vs non-strict rules
  • Use resource affinity for colocation constraints

Prerequisites

Verified against Proxmox VE 9.2.4 · Proxmox Backup Server 4.2.5 · Ceph Squid / Tentacle · Debian 13 (Trixie) · Linux kernel 7.0 (PVE 9.2 default) · 2026-08-12

Not yet marked complete on this device.

Why this matters in production

HA without rules places VMs on whatever node has capacity. In production, you usually want fine-grained control: keep this VM on this node, avoid that node, keep two VMs together. HA rules provide that control.

HA Groups were deprecated in PVE 9

In Proxmox VE 9.0, HA Groups were deprecated in favour of HA Node Affinity rules. HA Groups defined node lists with priorities; HA Rules are a more flexible, declarative model.

flowchart LR
  subgraph OLD[Old: HA Groups]
    G[Group: web-tier]
    N[Nodes pve-01:2, pve-02:1]
  end
  subgraph NEW[New: HA Rules]
    R[Rule: node-affinity]
    NL[Resources + nodes + priorities]
  end

Rule types

Two kinds of HA rules exist:

TypePurpose
node-affinityWhere resources can or must run
resource-affinityWhether resources must be co-located or separated

Node-affinity rules

A node-affinity rule constrains where a resource can run.

CLI:

ha-manager rules add node-affinity ha-vm100 --resources vm:100 --nodes pve-01

By default, the rule is non-strict: if the listed nodes are unavailable, the resource may run elsewhere. To make it strict:

ha-manager rules set node-affinity ha-vm100 --strict 1

To express priorities (preferred nodes):

ha-manager rules add node-affinity ha-web --resources vm:100,vm:101 --nodes "pve-01:2,pve-02:1,pve-03:1"

The CRM prefers pve-01; falls back to pve-02 or pve-03 equally; uses no others.

To express negative affinity (avoid a node):

ha-manager rules add node-affinity ha-avoid3 --affinity negative --resources vm:200,vm:300 --nodes pve-03

Resource-affinity rules

Resource affinity rules control whether resources are kept together or apart.

Keep together (positive):

ha-manager rules add resource-affinity keep-together --affinity positive --resources vm:100,vm:200

Keep apart (negative):

ha-manager rules add resource-affinity keep-separate --affinity negative --resources vm:200,ct:300

Verifying rules

Read-only / Safewhat rules apply to a resource, and are they satisfiable
set -euo pipefail
VMID=100

ha-manager rules config
ha-manager rules config --resource "vm:$VMID"
ha-manager config

# Do the nodes a strict rule names still exist and are they online?
ha-manager rules config --resource "vm:$VMID" | grep -i nodes
pvecm nodes
Read-only / Safea rule the cluster cannot satisfy shows up here
# ha-manager status
quorum OK
master pve-01 (active, Wed Aug 12 11:02:41 2026)
lrm pve-01 (active, Wed Aug 12 11:02:44 2026)
lrm pve-02 (active, Wed Aug 12 11:02:43 2026)
service vm:100 (pve-01, started)
service vm:140 (pve-03, error)

Illustrative output

Rule conflicts

The HA stack checks rules for feasibility, and the constraints are structural:

  • A resource may appear in only one node-affinity rule.
  • A negative node-affinity rule cannot list every cluster node - that would leave the resource nowhere to run.
  • A resource-affinity rule must have at least two resources.
  • A negative resource-affinity rule cannot cover more resources than there are nodes, since each must land somewhere different.

Conflicts are reported in ha-manager status.

Production considerations

Common mistakes

  • Strict rules that cannot be satisfied (cluster enters error state).
  • Resource-affinity with too many resources for the cluster size.
  • Forgetting to verify rules after editing.

Key takeaways

  • HA Groups are deprecated in PVE 9; use HA Node Affinity rules.
  • Node-affinity controls which nodes a resource can run on.
  • Resource-affinity controls co-location / separation.

Knowledge check

Knowledge check · 5 questions

  1. Q1. In PVE 9, which replaces HA Groups?

  2. Q2. Resource affinity is strict by default.

  3. Q3. Which option makes a node affinity rule strict?

  4. Q4. A VM needs a GPU that only two of five nodes have. Which rule should protect it, and why?

  5. Q5. Which of these will silently invalidate an existing HA rule? Select all that apply.

Passing score: 75%. Answers are checked in this browser.