视频
https://www.bilibili.com/video/av29593263/
https://www.bilibili.com/video/av29595464/
http://player.youku.com/embed/XMzc4MTMzOTg4OA==
curl -sSL get.docker.com | sh
sudo usermod pi -aG docker
sudo dphys-swapfile swapoff
sudo dphys-swapfile uninstall
sudo update-rc.d dphys-swapfile remove
编辑 cmdline.txt
cgroup_enable=cpuset cgroup_enable=memory
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install kubeadm
sudo kubeadm init --apiserver-advertise-address=192.168.60.110
mkdir -p $HOME/.kube
kubectl apply -f https://git.io/weave-kube-1.6
sudo kubeadm join 192.168.60.110:6443 --token 6x5taj.ydbcidcza2deadbw --discovery-token-ca-cert-hash sha256:832d65a8f675edf08f8f7110df2ef4b6a81bea048614e20e4d29eec1ccb4e1e3
查看节点状态,有时候 Ready 需要比较久的时间
kubectl get nodes
curl -O https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/alternative/kubernetes-dashboard-arm.yaml
kubectl create -f kubernetes-dashboard-arm.yaml
建立隧道本地访问管理页面
sudo ssh -L 8080:10.109.207.100:80 pi@192.168.60.110
kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')
http://127.0.0.1:8080/#!/login
测试
kubectl run nginx --image=nginx --replicas=3 --port=80
kubectl expose deployment nginx --port 80
sudo ssh -L 80:10.98.75.112:80 pi@192.168.60.110
参考链接:
https://medium.com/@mczachurski/kubernetes-on-raspberry-pi-with-net-core-36ea79681fe7