| giolekva | d8e0aa9 | 2020-04-29 11:17:07 +0400 | [diff] [blame] | 1 | ### Ubuntu 18.04 https://dev.to/wesleybatista/setup-raspberry-pi-3-model-b-with-ubuntu-server-and-ssh-over-wifi-4d41 |
| 2 | |
| giolekva | 2caa278 | 2020-04-27 16:41:47 +0400 | [diff] [blame] | 3 | ### setup rpi connectivity |
| 4 | ## enable wifi and ssh |
| 5 | # host |
| giolekva | d8e0aa9 | 2020-04-29 11:17:07 +0400 | [diff] [blame] | 6 | # set ssid/psswd in wpa_suplicant.conf/network-config |
| 7 | # Raspbian - cp wpa_supplicant.conf /Volumes/boot/ |
| 8 | # Ubuntu - sudoedit /etc/netplan/50-cloud-init.yaml and copy network-config into it |
| giolekva | 2caa278 | 2020-04-27 16:41:47 +0400 | [diff] [blame] | 9 | touch /Volumes/boot/ssh |
| 10 | ## attach rpi to ip address |
| 11 | # sudo add rpi to /etc/hosts |
| 12 | |
| 13 | |
| 14 | |
| 15 | ### k3s |
| 16 | ## create pcloud sudo user |
| 17 | # rpi |
| 18 | sudo adduser pcloud |
| 19 | sudo usermod -aG sudo pcloud |
| giolekva | d8e0aa9 | 2020-04-29 11:17:07 +0400 | [diff] [blame] | 20 | sudoedit /boot/firmware/cmdline.txt # append cgroup_memory=1 cgroup_enable=memory |
| 21 | sudo shutdown -r now |
| giolekva | 2caa278 | 2020-04-27 16:41:47 +0400 | [diff] [blame] | 22 | ## install k3s without traefik |
| 23 | # pcloud@rpi |
| giolekva | d8e0aa9 | 2020-04-29 11:17:07 +0400 | [diff] [blame] | 24 | curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="server --no-deploy traefik" K3S_KUBECONFIG_MODE="644" sh |
| giolekva | 2caa278 | 2020-04-27 16:41:47 +0400 | [diff] [blame] | 25 | ## copy kubeconfig on host |
| 26 | # pcloud@rpi |
| giolekva | d8e0aa9 | 2020-04-29 11:17:07 +0400 | [diff] [blame] | 27 | sudo chown pcloud /etc/rancher/k3s/k3s.yaml |
| giolekva | 2caa278 | 2020-04-27 16:41:47 +0400 | [diff] [blame] | 28 | # host |
| giolekva | d8e0aa9 | 2020-04-29 11:17:07 +0400 | [diff] [blame] | 29 | scp pcloud@rpi:/etc/rancher/k3s/k3s.yaml ~/.k3s.kubeconfig |
| giolekva | 2caa278 | 2020-04-27 16:41:47 +0400 | [diff] [blame] | 30 | sed -i -e 's/127\.0\.0\.1/rpi/g' ~/.k3s.kubeconfig |
| 31 | printf "\n\n#k3s kubeconfig\nexport KUBECONFIG=~/.k3s.kubeconfig\n" >> ~/.bash_profile |
| 32 | source ~/.bash_profile |
| 33 | kubectl get pods -A |
| giolekva | a7e37d7 | 2020-04-27 22:16:24 +0400 | [diff] [blame] | 34 | |
| 35 | |
| 36 | |
| 37 | ### ingress |
| 38 | ## traefik 2.0 |
| 39 | helm repo add traefik https://containous.github.io/traefik-helm-chart |
| 40 | helm repo update |
| 41 | kubectl create namespace traefik |
| 42 | helm --namespace=traefik install traefik traefik/traefik \ |
| 43 | --set additionalArguments="{--providers.kubernetesingress,--global.checknewversion=true}" \ |
| 44 | --set ports.traefik.expose=True |
| giolekva | 00aa972 | 2020-04-29 17:00:12 +0400 | [diff] [blame] | 45 | |
| 46 | |
| 47 | |
| giolekva | 1761bfc | 2020-05-04 14:13:47 +0400 | [diff] [blame^] | 48 | ### setup docker DO NOT INSTALL DOCKER, IT MESSES UP WITH k3s iptables |
| 49 | # sudo adduser docker |
| 50 | # sudo usermod -aG sudo docker |
| 51 | # sudo apt-get install docker.io |