Docker+Racher installation on Rocky Linux 8.5 on Dell Wyse 5070
Docker installation
First we need to add the docker repository, so its possible to install docker packages. This is done by adding the repository via the command
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf update
Then its possible to install the docker packages required:
sudo dnf install containerd.io docker-ce docker-ce-cli
When the installation has completed, then docker needs to be enabled by:
sudo systemctl enable docker
Kernel options
It seems like when you install docker it also installs selinux - even though I explicitly deselected the package when installing Rocky Linux via my kickstart file.
This kicks the installation into a restart loop that effectively prevents the machine from ever starting.
So to get it out of the restart loop I had to add the following to the grub command line:
selinux=0
So
edit /etc/default/grub
And change the line:
GRUB_CMDLINE_LINUX="resume=UUID=441a651e-570b-4e87-80c4-41e64defb94e rhgb quiet
So it turns into:
GRUB_CMDLINE_LINUX="resume=UUID=441a651e-570b-4e87-80c4-41e64defb94e rhgb quiet selinux=0
Then after having saved the file the actual grub command line is updated by running:
sudo grub2-mkconfig -o /boot/efi/EFI/rocky/grub-cfg
Since I am running UEFI.
Had I been running a BIOS boot I would have done:
grub2-mkconfig -o /boot/grub2/grub.cfg
Rancher
After having installed docker and verified that it is working it was time to install Rancher - so I pulled the rancher images and started it by doing:
sudo docker run -d --restart=unless-stopped --name rancher -p 80:80 -p 443:443 --privileged rancher/rancher:latest
But it seems like Linux Kernel 4.18.0-348.7.1.el8_5.x86_64 is not compatible with Rancher - no matter what I do I cannot get rancher to start within my docker container. It simply refuses to start.
k3s exited with: exit status 255
And it seems like someone at Rancher knows, but no solutions yet.
To get it working with Rocky Linux 8.5 you have to downgrade the kernel+systemd modules.
This is done by adding a repository to the 8.4 Rocky Linux:
sudo -E /bin/bash
cat <<EOT>>/etc/yum.repos.d/Rocky-BaseOS-8.4.repo
#Rocky Linux 8.4 BaseOS repo to get old versions of kernel+systemd
[baseos84]
name=Rocky Linux 8.4 - BaseOS
baseurl=http://dl.rockylinux.org/vault/rocky/8.4/BaseOS/x86_64/os/
gpgcheck=1
enabled=1
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
EOT
exit
And then do a
sudo dnf update
sudo dnf install kernel-4.18.0-305.25.1.el8_4.x86_64 systemd-239-45.el8_4.3.x86_64
Reboot the machine and it should be possible to install a working Rancher.
Obviously this leaves you vulnerable to updates - since running update again might install the broken versions once more. So be careful and only test updates on a single machine before deploying it to a full range of machines.
After the reboot, existing Ranger containers needs to be deleted by doing:
sudo docker ps
Which gives an output similar to:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d3dc0b1c0500 rancher/rancher:latest "entrypoint.sh" 11 minutes ago Up 10 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp rancher
Then you simply do a:
sudo docker stop rancher
sudo docker rm rancher
Where you replace ‘rancher’ with whatever name is in the “NAMES” column of the docker ps command output.
Then you can create the container again and remember to give it a name if you want a consistent name.
That is done by passing a
--name <name>
parameter.
sudo docker run -d --restart=unless-stopped --name rancher -p 80:80 -p 443:443 --privileged rancher/rancher:stable
If you want your rancher docker container to survive recreations or upgrades - add a persistent volume for the rancher configuration via:
-v /opt/rancher:/var/lib/rancher
So your full commandline looks like:
sudo docker run -d --restart=unless-stopped --name rancher -p 80:80 -p 443:443 -v /opt/rancher:/var/lib/rancher --privileged rancher/rancher:stable
Where you change /opt/rancher for whatever server path on the docker host you want to use for storing the rancher configuration.
Not to be confused with the the path within the docker container itself.
Wait a couple of minutes to let the container fully start and you should be able to log into the rancher installation using the hostname of the machine in a browser.
You can find the bootstrap password by doing a:
sudo docker logs rancher 2>&1|grep "Bootstrap Password:"
Which will give you an output similar to:
2022/02/06 13:45:09 [INFO] Bootstrap Password: xsn88v5qnnwclt798x565nmhsz26vtsq9vtwn6ftjg7p5hs585zv8g
Change the default 12 character requirements for password after initial login by going to:
https://<rancher-host>/v3/settings/password-min-length
Then update the password for the admin user for something simpler if required.
Congratulations you now have a Rancher installation running on Rocky Linux 8.5.
Next part up is the actual cluster installation on my nodes.