Skip to content

Instantly share code, notes, and snippets.

@iomarian
Created May 29, 2020 15:37
Show Gist options
  • Save iomarian/718d970a2981e148c40580484355065b to your computer and use it in GitHub Desktop.
Save iomarian/718d970a2981e148c40580484355065b to your computer and use it in GitHub Desktop.
Install Rancher on RHEL 7

RHEL 7 Docker Rancher

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

On rancher manager node only:

docker run -d --name rancher --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:v2.1.0-rc9

Add Kubernetes nodes

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

Optional: sudo without password

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment