Install Docker on all of the host machines:
yum upgrade -y
reboot
subscription-manager repos --enable rhel-7-server-extras-rpms
yum install -y docker
systemctl enable docker
If you want to clone this VM for the k8s nodes poweroff and snapshot. Note this will cause authentication problems now or in the future. Then run
systemctl start docker
docker run -d --name rancher --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:v2.1.0-rc9
Log on to the Rancher manager node and create a Custom
cluster in the Rancher web interface (From my own existing nodes
).
Add controllers and workers following the instructions.
For example, on controller nodes that include etcd:
sudo docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v /var/run:/var/run rancher/rancher-agent:v2.1.0-rc9 --server https://10.0.0.1 --token TOKEN --ca-checksum CHECKSUM --etcd --controlplane
On worker nodes:
sudo docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v /var/run:/var/run rancher/rancher-agent:v2.1.0-rc9 --server https://10.0.0.1 --token TOKEN --ca-checksum CHECKSUM --worker
I you are running a lot of administrative commands you can allow password-less sudo:
echo "<USER> ALL=(ALL) NOPASSWD: ALL"> /etc/sudoers.d/nopasswd