Setting up XCP-ng Cluster
XCP-ng is a powerful, open-source hypervisor platform that enables us to create and manage virtual infrastructure. In this guide, we’ll walk through the complete process of setting up an XCP-ng cluster, from initial installation to configuring Xen Orchestra for management.
Part-II has been published at following link:
This post is continuation of my home lab story from following:
Installation process is pretty simple but for any hypervisor, we need to prepare the network, storage etc. in advance. I went over that in my above post about preparing to install multiple hypervisors. Here is what we plan to cover in this post:
Here’s what we’ll cover:
XCP-ng Cluster Setup
- Basic installation and configuration of XCP-ng hosts
- Creating a cluster environment
- Understanding cluster requirements and considerations
Xen Orchestra Deployment
- Different deployment options for Xen Orchestra
- Understanding the “inception” architecture (XO managing its own host)
- Managing multiple clusters from a single XO instance
Virtual Machine Management
- Creating new virtual machines
- Resource adjustment
- Available operations for running and stopped VMs
Part 1: Downloading and Creating Installation Media
- Visit the official XCP-ng website (https://xcp-ng.org/download/)
- Download the latest ISO image
- Create a bootable USB drive
Part 2: Base Installation
- Boot from the installation media
- Select ‘Install XCP-ng’
- Accept the license agreement
- Select your primary disk for installation
- Set a root password (use a strong password and document it securely)
- Configure networking:
- Select your management NIC
- Choose DHCP or set static IP (recommended for servers)
- Set hostname (e.g., xcpng-1, xcpng-2)
7. Set time zone and NTP servers
8. Complete installation and reboot
If you are just exploring, here are snapshots of involved steps:
Once installed, we can see Console like below:
I installed three hosts named xcp-1, xcp-2,xcp-3
Part 3: Understanding Xen-Orchestra
Before we start managing cluster using xen orchestra, let us first understand its deployment. One of the most interesting aspects of Xen Orchestra (XO) deployment is what we might call the “inception” scenario — where XO runs as a VM on the very infrastructure it manages. Let’s break down this pattern.
Self-Hosted Deployment
Advantages:
- Resource efficiency — uses existing infrastructure
- No additional hardware required
- Built-in high availability through XCP-ng HA features
- Direct network access to hosts
- Integrated backup infrastructure
Considerations:
- Seems counterintuitive — managing platform runs on platform itself
- Requires careful planning for maintenance scenarios
- Need strategy for “bootstrap” situations
External Deployment
Advantages:
- Clear separation of management and production infrastructure
- Independent maintenance possible
- Easier disaster recovery scenarios
- Can manage multiple clusters from one instance
Considerations:
- Requires additional hardware/resources
- Network connectivity must be planned carefully
- Additional system to maintain
Why Self-Hosted Works
Despite seeming counterintuitive, running XO on the infrastructure it manages is actually a robust solution. VM can be protected by XCP-ng’s HA features. Automatic failover if host fails.
Managing Multiple Clusters
One of XO’s powerful features is its ability to manage multiple XCP-ng clusters from a single instance.
Benefits of Centralized Management:
- Single pane of glass for all environments
- Consistent policies across clusters
- Unified backup management
- Centralized user authentication
- Resource optimization across clusters
Xen-Orchestra : Summary
While running XO on the infrastructure it manages might seem strange at first, it’s a good and practical approach. The key is understanding that XO is simply a management interface to the underlying XCP-ng infrastructure, which remains functional even if XO is temporarily unavailable.
For home labs and smaller deployments, self-hosted XO provides an efficient, cost-effective solution. For larger environments, especially those with multiple clusters, either approach can work well based on specific requirements and constraints.
The ability to manage multiple clusters, regardless of deployment method, makes XO a powerful tool for infrastructure management, offering flexibility and scalability as our environment grows.
Part 4: Setup Xen-Orchestra
In the browser navigate to the IP of one of the hosts and follow instructions to install XOA (Xen-Orchestra Appliance). It is mostly a paid product and one we should use in production. But for homelab, let us just go with a few weeks trial with full features and then limited one. Also, later we’ll install XO from sources on separate VM and that one we can continue to use for free (again without paid/pro features).
NOTE: XOA is a paid product but XO itself is not
Navigate to the IP you selected for XOA and use credentials selected above and should see something like below:
Explore various options/tabs:
Create a VM
Let us now create a VM. Click on the new VM button and select the pool. Enter machine name, type, ISO, network and disk:
As I have separate interfaces for management and VMs, I picked eth1 for VM. Click Create. In few seconds, will see something like:
If we click on Console we can through typical Ubuntu installation or any distro you may have selected:
Once done and started, can explore various tabs for this VM:
If we go to Advanced tab, we have couple of options disabled:
Warm migration is available only in the Pro version it seems in XOA (although it is available through other means as we’ll see in next post).
Convert to template would be enabled when we stop the VM
Let us stop the VM to see couple of options in action:
After stopping, few options got enabled in Advanced tab:
* We can now Clone the VM
* Convert to template
* Warm migration was not available in free version but now we have option to Start this VM on different VM (cold migration)
Conclusion:
In this post, we explored the foundational aspects of setting up and managing a virtualization environment using XCP-ng and Xen Orchestra.
What’s Next?
In our next post, we’ll dive deeper into advanced XCP-ng features and management, including:
Networking
- Network types and configurations
- VLANs and bonds
Storage Management
- Local storage configuration
- Shared storage options (NFS, iSCSI)
- Storage best practices
Command Line Interface (CLI)
- Essential xe commands
- Automation possibilities
- Script-based management
VM Migration
- Types of migration
- Requirements and prerequisites
- Troubleshooting common issues
Additional Resources
- XCP-ng Documentation: https://xcp-ng.org/docs/
- Xen Orchestra Documentation: https://xen-orchestra.com/docs/
- XCP-ng Forum: https://xcp-ng.org/forum/