Clustering Guide
PiVirt clustering enables multi-host orchestration with unified CLI control, distributed state management, shared storage pools, and live VM workload migration.
Cluster Setup
Section titled “Cluster Setup”Initialize Cluster
Section titled “Initialize Cluster”# Single nodepvcli cluster init --name dev-cluster
# Multi-nodepvcli cluster init --name prod-cluster --control-plane 3Join Nodes
Section titled “Join Nodes”# Generate join tokenpvcli cluster token create --ttl 24h
# Join nodepvcli cluster join --token <token> --node-ip 10.0.1.11Node Management
Section titled “Node Management”Add Nodes
Section titled “Add Nodes”# Add worker nodespvcli cluster node add --role worker --count 3
# Add specific nodepvcli cluster node add --name worker-04 --ip 10.0.1.24Remove Nodes
Section titled “Remove Nodes”# Drain nodepvcli cluster node drain worker-03
# Remove nodepvcli cluster node remove worker-03Maintenance
Section titled “Maintenance”# Cordon nodepvcli cluster node cordon worker-01
# Drain nodepvcli cluster node drain worker-01
# Uncordon after maintenancepvcli cluster node uncordon worker-01High Availability
Section titled “High Availability”Control Plane HA
Section titled “Control Plane HA”# Initialize with 3 control plane nodespvcli cluster init --name prod-cluster \ --control-plane 3 \ --etcd-members 3Storage HA
Section titled “Storage HA”cluster: storage: type: "iscsi" multipath: true fencing: enabled: true agent: "ipmi"Cluster Operations
Section titled “Cluster Operations”Upgrade Cluster
Section titled “Upgrade Cluster”# Check current versionpvcli cluster get prod-cluster -o json | jq '.version'
# Upgradepvcli cluster upgrade --version v0.0.90 --strategy rollingBackup Cluster
Section titled “Backup Cluster”# Backup etcdpvcli cluster backup create --name backup-2024-01-15
# Restorepvcli cluster backup restore --name backup-2024-01-15Best Practices
Section titled “Best Practices”1. Use Odd Number of Control Plane Nodes
Section titled “1. Use Odd Number of Control Plane Nodes”- 3 nodes for small clusters
- 5 nodes for large clusters
- Ensures quorum
2. Distribute Across Failure Domains
Section titled “2. Distribute Across Failure Domains”spec: controlPlane: antiAffinity: true topologyKey: "kubernetes.io/hostname"3. Enable Fencing
Section titled “3. Enable Fencing”cluster: fencing: enabled: true agent: "ipmi" devices: - name: "node-01-fence" ip: "10.0.0.11"Troubleshooting
Section titled “Troubleshooting”Node Not Joining
Section titled “Node Not Joining”# Check network connectivityping 10.0.1.10
# Check token validitypvcli cluster token verify <token>
# Check logsjournalctl -u pivirt-agent -fQuorum Lost
Section titled “Quorum Lost”# Check etcd statusetcdctl endpoint health
# Restore from backuppvcli cluster backup restore --name backup-2024-01-15