Skip to content

Instantly share code, notes, and snippets.

@othyn
Last active March 16, 2022 11:28
Show Gist options
  • Save othyn/87765439d6fa8bdbb193c50935a3b4e1 to your computer and use it in GitHub Desktop.
Save othyn/87765439d6fa8bdbb193c50935a3b4e1 to your computer and use it in GitHub Desktop.
#!/bin/sh
set -e
# Usage:
# $ https://gist.githubusercontent.com/othyn/87765439d6fa8bdbb193c50935a3b4e1/raw/02a7e9f0e957b286965f88637fac0b6b2b5f7b30/setup_rancher_node.sh | sh
# Designed for:
# - Ubuntu 20.04.4
# - Rancher v2.4.17
# - Docker 20.10
# https://rancher.com/docs/rancher/v2.6/en/installation/requirements/installing-docker/
curl https://releases.rancher.com/install-docker/20.10.sh | sh
# dockerd-rootless-setuptool.sh install
# [ERROR] Missing system requirements
sudo sh -eux <<EOF
# Install newuidmap & newgidmap binaries
apt-get install -y uidmap
EOF
# Setup rootless Docker
dockerd-rootless-setuptool.sh install
# Add required PATH variables
# Double check with:
# $ tail -n 5 ~/.bashrc
echo -e "\nexport PATH=/usr/bin:\$PATH" >> ~/.bashrc
echo "export DOCKER_HOST=unix:///run/user/1000/docker.sock" >> ~/.bashrc
# Done
echo -e "\n\n-----\nDocker installation complete"
echo "RE-LOG NOW!"
echo "After logging back in, paste the Rancher node setup command to get things going."
# Rancher command will be something like:
# sudo docker run -d \
# --privileged \
# --restart=unless-stopped \
# --net=host \
# -v /etc/kubernetes:/etc/kubernetes \
# -v /var/run:/var/run \
# rancher/rancher-agent:v2.4.17 \
# --server {ADDRESS} \
# --token {TOKEN} \
# --ca-checksum {CHECKSUM} \
# --etcd \
# --controlplane \
# --worker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment