k3s

  • pi1: 192.168.1.101
  • pi2: 192.168.1.102
  • pi3: 192.168.1.103
$ sudo cat /etc/hostname

$ sudo cat /etc/hosts

$ sudo cat /boot/cmdline.txt
console=serial0,115200 console=tty1 root=PARTUUID=aca8d6f8-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory

$ sudo reboot
pi@pi1:~ $ curl https://get.k3s.io | sudo bash
pi@pi1:~ $ sudo systemctl status k3s
pi@pi1:~ $ sudo cat /var/lib/rancher/k3s/server/node-token

pi@pi2:~ $ curl https://get.k3s.io | sudo K3S_URL=https://pi1:6443 K3S_TOKEN=xxxxxx bash
pi@pi2:~ $ sudo systemctl status k3s-agent

pi@pi3:~ $ curl https://get.k3s.io | sudo K3S_URL=https://pi1:6443 K3S_TOKEN=xxxxxx bash
pi@pi3:~ $ sudo systemctl status k3s-agent
pi@pi1:~ $ sudo kubectl get node

pi@pi1:~ $ sudo kubectl apply -n portainer -f https://raw.githubusercontent.com/portainer/k8s/master/deploy/manifests/portainer/portainer.yaml
pi@pi1:~ $ sudo k3s-uninstall.sh

pi@pi2:~ $ sudo k3s-agent-uninstall.sh

pi@pi3:~ $ sudo k3s-agent-uninstall.sh

参考: https://theselfhostingblog.com/posts/setting-up-a-kubernetes-cluster-using-raspberry-pis-k3s-and-portainer/

GitHub - alexellis/k3sup: bootstrap Kubernetes with k3s over SSH < 1 min 🚀
bootstrap Kubernetes with k3s over SSH < 1 min 🚀. Contribute to alexellis/k3sup development by creating an account on GitHub.