Ubuntu 16.04をRancher 2.0用に構成する

by もっへもへ 2018-06-11 00:09

主にCloudGarage用
Rancher2.0がDocker 17.03までしか対応してないからそれで
k8s立てるのにも使えるよ


とりあえずシステムアップデート

apt update
apt -y upgrade
systemctl reboot

Docker入れる

apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt update
apt install -y docker-ce=17.03.2~ce-0~ubuntu-xenial
systemctl enable --now docker

ユーザーつくる

USERNAME=mohemohe
apt install -y zsh
groupadd wheel
echo '%wheel ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
useradd -G wheel,docker -s $(which zsh) -m ${USERNAME}
cp -r .ssh /home/${USERNAME}/
chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.ssh
sudo -u ${USERNAME} -i
curl https://raw.githubusercontent.com/mohemohe/dotfiles/master/install.sh | sh

どっかーん

docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v /var/run:/var/run rancher/rancher-agent:v2.0.2 --server https://rancher.manage.plusminus.io --token XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --ca-checksum YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY --worker