me icon indicating copy to clipboard operation
me copied to clipboard

体验 Kubeadm

Open nonocast opened this issue 2 years ago • 0 comments

Version: multipass 1.9.1+mac, ubuntu 20.04, kubeadm 1.24.2, macOS 12.3.1

multipass

  • Multipass 旋风教程 - 知乎
  • 因为kube的配置需要2核1700M内存,所以需要添加参数: multipass launch --name primary --cpus 2 --mem 2000M 20.04

kubeadm

部署Kubernetes的Master节点

  • multipass launch --name primary --cpus 2 --mem 2000M 20.04
  • install docker: sudo apt-get install docker.io
  • Installing kubeadm | Kubernetes
  • kubeadm init
  • 然后会得到join的token: kubeadm join 192.168.64.7:6443 --token sbi9z4.ls0jkyknux490hyp \ --discovery-token-ca-cert-hash sha256:f9ae8a51a2c8a1f7c9bff731cdf1ba97fd945fdd0ea28db532f2e338d6c21338
  • 部署网络插件 kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
  • 通过 kubectl get pods -n kube-system 检查Pod运行状态
  • 最后通过kubectl describe node primary检查运行状态服务是否ready

部署Kubernetes的Worker节点

  • multipass launch --name worker1 --cpus 2 --mem 2000M 20.04
  • install docker: sudo apt-get install docker.io
  • Installing kubeadm | Kubernetes
  • kubeadm join 192.168.64.7:6443 --token sbi9z4.ls0jkyknux490hyp \ --discovery-token-ca-cert-hash sha256:f9ae8a51a2c8a1f7c9bff731cdf1ba97fd945fdd0ea28db532f2e338d6c21338

然后在primary上检查,

~ kubectl get nodes
NAME      STATUS   ROLES           AGE     VERSION
primary   Ready    control-plane   38m     v1.24.2
worker1   Ready    <none>          2m28s   v1.24.2
~  
~ kubectl get cs
Warning: v1 ComponentStatus is deprecated in v1.19+
NAME                 STATUS    MESSAGE                         ERROR
controller-manager   Healthy   ok                              
scheduler            Healthy   ok                              
etcd-0               Healthy   {"health":"true","reason":""}   

nonocast avatar Jul 06 '22 14:07 nonocast