Install Necessary Packages on Both Nodes
Begin by installing Incus and its associated tools on both node1 and node2.
- apt update sudo apt install incus incus-tools
The
incus-toolspackage includes utilities likelxc-to-incus, which facilitates the migration of LXC containers to Incus.
2. Initialize Incus on Both Nodes
After installation, initialize Incus to set up storage pools, networks, and other configurations.
- incus admin init
This command will guide you through the initial configuration process.
3. Migrate LXC Containers to Incus
On the node where your LXC containers reside, use the lxc-to-incus tool to migrate them to Incus.
Stop the LXC Containers:
- lxc-stop -n <container-name>
Run the Migration Tool:
- lxc-to-incus --containers <container-name>
Replace
<container-name>with the name of your LXC container. To migrate all containers simultaneously, use the--allflag.
4. Verify the Migration
After migration, confirm that the containers are present in Incus:
- incus list
This command will display a list of all containers managed by Incus.
5. Set Up Networking for Containers
To ensure your containers have network connectivity, create and attach a network bridge:
- Create a Network Bridge:
- incus network create my-bridge
- Attach the Bridge to the Container:
- incus network attach my-bridge <container-name> eth0
Replace
<container-name>with the name of your container.
6. Move Containers Between Nodes
To move a container from node1 to node2:
Ensure Both Nodes Are Clustered:
Incus supports clustering, allowing multiple nodes to be managed together. Ensure that both
node1andnode2are part of the same cluster.- Move the Container:
- incus move <container-name> --target <target-node>
Replace
<container-name>with the name of your container and<target-node>with the name of the destination node (e.g.,8core).
7. Address Migration Errors
If you encounter errors during migration, such as issues with CRIU (Checkpoint/Restore in Userspace):
- Install CRIU:
apt install criu- Disable Nesting:
sudo incus config set <container-name> security.nesting falseAfter making these changes, retry the migration.
8. Access the Container
To access the container's shell:
- incus exec <container-name> -- /bin/bash
Replace <container-name> with the name of your container.