Scaling a Heterogeneous Proxmox VE & Ceph Cluster: From min_size 1 to Balanced High Availability

 


Core Infrastructure Terminology

Before diving into the architecture and operational runbooks, here is a quick reference for the core distributed systems and virtualization concepts used throughout this post:

  • HA (High Availability): Automated detection of node or service failure followed by workload recovery on healthy nodes to minimize downtime.

  • Ceph: A software-defined, distributed storage system that aggregates local disks across cluster nodes into a unified, fault-tolerant storage pool.

  • OSD (Object Storage Daemon): The Ceph service responsible for storing data on a specific drive, handling read/write I/O, and managing replication and recovery across peers.

  • PG (Placement Group): A logical grouping of objects used by Ceph to map data across OSDs efficiently and manage replication states.

  • size and min_size: size defines the total number of object replicas maintained in a pool; min_size sets the minimum number of active replicas required for a PG to accept write operations.

  • LXC (Linux Container): An OS-level containerization technology that shares the host kernel, offering fast startup times and low overhead for Linux workloads.

  • HA Node Affinity Rules: Policy rules in Proxmox HA that define preferred placement nodes and automated failback behavior when a preferred node recovers.

  • Failback: The automated or controlled return of a workload to its preferred primary node once that node returns to a healthy, available state.

  • iowait: The percentage of CPU time spent idle while waiting for pending disk or storage I/O operations to complete.


1. Introduction: Pragmatic Engineering in Heterogeneous Clusters

Reference architectures and vendor whitepapers often assume uniform hardware: identical server chassis, matched NVMe endurance tiers, dedicated storage fabrics, and clean textbook quorum math. In real-world infrastructure—whether in a multi-node lab environment or a lean, cost-conscious enterprise or branch deployment—hardware rarely arrives in pristine symmetry.

When operating a four-node Proxmox VE cluster built across mixed hardware generations with Ceph distributed storage, compute headroom, PCIe lanes, memory bandwidth, and storage I/O profiles differ from node to node. Treating every machine as identical invites hidden bottlenecks, unpredictable latency spikes, and noisy-neighbor contention.

Strong infrastructure engineering is not about blindly copying a textbook diagram; it is about pragmatic trade-off management. It means understanding real hardware limits, protecting workload continuity during transitions, documenting failure modes, and iterating toward a clean, resilient steady state without sacrificing operational safety.

# Verify cluster membership, quorum status, and active node resources
pvecm status
pvesh get /cluster/resources --type node

2. Ceph Storage Trade-Offs: Operating at min_size 1 During Transitions

One of the most nuanced operational choices in small or evolving Ceph clusters is balancing write availability against replication safety via min_size.

In a standard size 3 / min_size 2 pool configuration, Ceph requires at least two active OSD replicas to acknowledge writes for a given Placement Group. If two OSDs or host nodes go offline simultaneously—or become unavailable during maintenance or rebalancing—affected PGs pause writes to protect data integrity. In a virtualization cluster, paused storage I/O quickly cascades into hung container starts, stalled migrations, and sluggish management operations.

Temporarily setting min_size 1 during an active cluster transition gives administrators operational breathing room: workloads can continue writing and migrating even while OSD capacity is being expanded or nodes are being rebalanced.

At the same time, a green HEALTH_OK status does not eliminate risk:

  • Reduced fault tolerance during recovery: At min_size 1, losing a single remaining OSD holding the sole active copy of a PG before recovery finishes can result in unfound objects or data loss for that pool.

  • No multi-replica write quorum: Writes are committed with a single OSD acknowledgment, making drive health, filesystem/block reliability, and network stability critical.

To keep min_size 1 disciplined rather than reckless, treat it strictly as a deliberate transition state with clear guardrails:

  • Monitor cluster state continuously with ceph -s and audit pool parameters so degraded or misplaced PGs are addressed promptly.

  • Keep storage and cluster networks clean and low-latency so recovery and backfill complete predictably.

  • Maintain an explicit capacity plan to return to min_size 2 as soon as sufficient independent OSDs are online.

# Inspect overall Ceph health, OSD layout, and pool replication settings
ceph -s
ceph osd tree
ceph osd pool ls detail | grep -E "pool|size"

# Temporarily set min_size to 1 on a target pool during controlled transition work
ceph osd pool set <pool-name> min_size 1

3. Modernizing Failover: From Legacy HA Groups to HA Node Affinity Rules

As cluster automation matures, predictable failback matters just as much as initial failover. Transitioning from legacy HA groups to HA Node Affinity Rules (using positive node affinity with strict: false) provides clearer control over where workloads prefer to run and how they return after an outage.

  • Clear Preferred Placement: Each HA-managed workload can be mapped to a preferred node suited to its compute and I/O profile.

  • Non-Blocking Failover with Automated Failback: Because strict: false allows non-strict affinity, HA can still place or fail over a workload onto another healthy node if the preferred node is down, then automatically fail it back once the preferred node is back online and healthy.

Key operational rule: Never treat manual migrations and HA affinity rules as independent actions. If you manually migrate a container to a new node while its affinity rule still points to the old node—or while HA is actively managing its desired state—the HA manager can immediately fight your change or trigger conflicting state transitions. Always align the affinity rule with the intended target node before or alongside workload moves.

# Inspect current HA resource states, manager status, and affinity rules
ha-manager status
ha-manager config
cat /etc/pve/ha/rules.cfg

4. Incident Postmortems: Migration Locks and I/O Latency

Infrastructure resilience is forged during real incidents—when a live operation times out or a monitoring alert points to a deeper hardware mismatch. Two recurring failure patterns stand out: stuck container migration locks and storage-induced monitoring latency.

A. Resolving Stuck LXC Migration Locks and Monitor Socket Timeouts

When a container migration or stop operation collides with high I/O load or an HA state transition, the LXC monitor process can time out and leave a stale lock flag (such as lock: migrate or lock: mounted) on the container configuration. Subsequent start, stop, or migrate commands then fail with lock or missing-PID errors.

A clean, repeatable recovery sequence prevents HA interference and restores consistent state:

  1. Place the resource in ignored state: Temporarily set the container to ignored in ha-manager so the HA agent does not attempt automated recovery or restarts mid-intervention.

  2. Inspect and clear the stale lock: Confirm the lock key in the container config, clear it with pct unlock, and ensure any hung container or monitor process is cleanly stopped before migrating.

  3. Migrate and re-enable HA: Because container root disks reside on shared Ceph storage, metadata/config migration to the target node is fast; once verified, return the resource to started in HA.

# 1. Set HA state to ignored so HA does not interfere during remediation
ha-manager set ct:<ct-id> --state ignored

# 2. Verify and clear any leftover configuration lock
pct config <ct-id> | grep -i lock
pct unlock <ct-id>

# 3. Force stop if monitor socket hung, verify stopped state, and migrate to target node
pct stop <ct-id> --skiplock 1
pct status <ct-id>
pct migrate <ct-id> <target-node>

# 4. Restore HA management (ensure HA Node Affinity rule is updated to match)
ha-manager set ct:<ct-id> --state started

B. Eliminating High iowait and Agent Timeouts in Monitoring Workloads

Not every alert is a software bug; many are capacity or I/O mismatches. When a time-sensitive monitoring workload ran on an older node with lower CPU throughput and older storage/I/O paths, overlapping database writes, housekeeping tasks, and Ceph background activity drove up CPU iowait. Elevated iowait delayed polling and agent responses long enough to trigger availability timeouts.

Moving that monitoring workload onto a more capable node with stronger compute and faster storage I/O immediately reduced iowait and stabilized metric collection.

# Measure CPU iowait (%wa) and block device latency before and after workload migration
vmstat 1 5
iostat -xz 1 3

5. Workload-to-Hardware Alignment Across the Cluster

In a mixed-capability cluster, stability improves dramatically when workloads are placed according to their resource and I/O characteristics rather than spread blindly:

  • Higher-Capability Nodes: Best suited for I/O-heavy and compute-sensitive workloads—such as monitoring platforms, databases, and automation/IaC runners—where higher clock speeds, memory bandwidth, and storage throughput absorb bursty writes and background Ceph traffic.

  • Lower-Power / Legacy Nodes: Better matched to lightweight, low-write services such as static portals or simple dashboards that place minimal demand on disk I/O and CPU.

  • Quorum / Light Nodes: Ideal for low-overhead listeners, security sensors, or lightweight utility services where keeping CPU and I/O light protects cluster responsiveness.

Aligning workload profiles with hardware tiers lowers contention across the cluster, keeps iowait manageable, and makes HA failover behavior far more predictable.

# Audit current placement of VMs and LXC containers across all cluster nodes
pvesh get /cluster/resources --type vm --output-format text

6. Scaling to min_size 2: Capacity Expansion and Verification

With workload placement balanced and HA rules aligned, the next architectural milestone is scaling out storage capacity—such as adding another node equipped with dedicated OS storage (e.g., NVMe) and a separate SSD for Ceph OSD—so the pool can safely run at size 3 / min_size 2.

Before and after bringing a new OSD online, follow a structured verification checklist:

  1. Failure Domain & OSD Layout Check: Confirm OSDs are distributed properly across distinct hosts (host failure domain) so replicas are not concentrated on a single node.

  2. Controlled Rebalance Monitoring: Watch ceph -w during recovery and backfill so data movement completes cleanly without starving active workloads.

  3. Failover & Boot Validation at min_size 2: Test container migrations and simulated node maintenance under min_size 2 to verify that write quorum behaves as expected and services start cleanly.

# After adding the new node and OSD, verify distribution and raise min_size to 2
ceph osd df tree
ceph osd pool set <pool-name> size 3
ceph osd pool set <pool-name> min_size 2
ceph -w

7. Closing Reflection: Building Resilient Systems Incrementally

Resilient infrastructure rarely starts out flawless on day one. Whether you are refining a lab environment or engineering production systems on constrained budgets, real reliability comes from owning your trade-offs: knowing why a temporary setting like min_size 1 is used, keeping HA affinity rules aligned with reality, executing calm recovery steps when locks or timeouts occur, and continuously matching workloads to hardware strengths.

Every migration, postmortem, and capacity upgrade turns ad-hoc tinkering into repeatable engineering discipline—the exact mindset that keeps distributed systems dependable as they grow.


# Final end-to-end health check across storage and HA services
ceph -s && ha-manager status

Verdict & Executive Summary

Bottom-Line Verdict: Running a heterogeneous Proxmox VE and Ceph cluster with a deliberate min_size 1 transition state, non-strict HA Node Affinity Rules (strict: false), and hardware-aligned workload placement is a sound, pragmatic engineering path toward a size 3 / min_size 2 steady state—provided write-quorum trade-offs are actively monitored and affinity rules stay synchronized with manual migrations.

  • Storage Continuity vs. Risk: Temporary min_size 1 prevents write stalls during cluster transitions, while min_size 2 with balanced OSDs restores stronger multi-replica write protection once capacity expansion completes.

  • Predictable Failover & Failback: Positive HA Node Affinity Rules (strict: false) support automatic failback to preferred nodes without blocking failover, provided rules and migrations are updated together.

  • Operational Reliability: Resolving stale locks (ha-manager set ... --state ignored + pct unlock) and moving I/O-heavy monitoring/IaC workloads to faster nodes eliminates iowait-driven timeouts and keeps cluster behavior steady.

Comments

Popular posts from this blog

AdGuard Home DNS for Newbies - Part 3

AdGuard Home DNS for Newbies - Part 1

Implementing a professional QoS configuration on MikroTik RouterOS v7