Migrating the Uyuni server to a containerized environment
To migrate a regular Uyuni server to a container, a new machine is required.
It is not possible to perform an in-place migration. |
The old server is designated as the source server and the new machine is the destination one.
The migration procedure does not perform any hostname rename. The fully qualified domain name will be the same on the new server than on the source one. This means the DNS records need to be adjusted after the migration to use the new server.
1. Initial preparation
-
Stop the source server:
spacewalk-service stop
-
Stop the source services:
systemctl stop postgresql
2. Preparing the SSH connection
The SSH configuration and agent should be ready on the host for a passwordless connection to the source server. The migration script only uses the source server fully qualified domain name in the SSH command. This means that every other configuration required to connect needs to be defined in the ~/.ssh/config file.
For a passwordless connection, the migration script will use an SSH agent on the server. If none is running yet, run eval $(ssh-agent). Add the SSH key to the running agent using ssh-add /path/to/the/private/key. The private key password will be prompted.
3. Is SELinux enabled?
Verify that SELinux is enabled on the new host by running getenforce
. If the output is Enforcing
, SELinux is enabled. In such case, we temporarily provide this Custom policy to allow the migration script to run.
This file needs to be copied to /root/uyuni-selinux-policy.cil`
on the new host.
The migration script will load the policy into the new host and pass it as podman argument to run the migration script.
4. Prepare for Kubernetes
Since the migration job will start the container from scratch the Persistent Volumes need to be defined before running the mgradm migrate command. Refer to the installation section for more details on the volumes preparation.
5. Migrating
Run the following command to install a new Uyuni server from the source one after replacing the uyuni.source.fqdn by the proper source server FQDN: This command will synchronize all the data from the source server to the new one: this can take time!
mgradm migrate podman uyuni.source.fqdn
or
mgradm migrate kubernetes uyuni.source.fqdn