当 2 个 worker nodes 节点加入到 Kubernetes / k8s 集群后,我们去master节点、执行kubectl get nodes 命令就可以看到worker节点了
但是我们会看到无论是master节点、还是worker 节点, STATUS 都会是 NotReady, 如下
[root@k8s-master qq-5201351]# kubectl get nodes NAME STATUS ROLES AGE VERSION k8s-master NotReady control-plane,master 9m35s v1.23.6 k8s-node1 NotReady <none> 8m30s v1.23.6 k8s-node2 NotReady <none> 9s v1.23.6
我们继续查看 PO 的状态,也会发现有两个 coredns-xxxxxxxxx-xxxxx 的状态,一直是 Pending,正是因为POD的状态异常,所以上面的状态才是NotReady
[root@k8s-master qq-5201351]# kubectl get po -A NAMESPACE NAME READY STATUS RESTARTS AGE kube-system coredns-6d8c4cb4d-rm26d 0/1 Pending 0 9m26s kube-system coredns-6d8c4cb4d-xmzgb 0/1 Pending 0 9m26s kube-system etcd-k8s-master 1/1 Running 0 9m40s kube-system kube-apiserver-k8s-master 1/1 Running 0 9m40s kube-system kube-controller-manager-k8s-master 1/1 Running 0 9m40s kube-system kube-proxy-2tzxv 1/1 Running 0 18s kube-system kube-proxy-gwvwz 1/1 Running 0 9m26s kube-system kube-proxy-mtwrv 1/1 Running 0 8m39s kube-system kube-scheduler-k8s-master 1/1 Running 0 9m40s [root@k8s-master qq-5201351]#
要解决上面的状态异常问题、就需要安装部署网络服务组件,可以有多种选择,这里笔者选择,calico ,版本 v3.25
1、下载calico ,版本 v3.25 的yaml文件
curl https://docs.projectcalico.org/archive/v3.25/manifests/calico.yaml -O
2、修改yaml配置,可以搜索CALICO_IPV4POOL_CIDR,将如下两行的注释打开,并且修改其值为我们初始化时定义的 --pod-network-cidr的值
# - name: CALICO_IPV4POOL_CIDR # value: "192.168.0.0/16"
前面笔者定义的值为:10.224.0.0/16, 注意取消注释后,还需要保证- name 项与前后项对齐
3、从calico.yaml文件中,Apply a configuration to a resource
kubectl apply -f calico.yaml
过程可能较为缓慢、完成后,再看 master , worker 节点,以及POD资源状态,就都是正常的了,如下:
[root@k8s-master qq-5201351]# kubectl get nodes NAME STATUS ROLES AGE VERSION k8s-master Ready control-plane,master 29m v1.23.6 k8s-node1 Ready <none> 28m v1.23.6 k8s-node2 Ready <none> 20m v1.23.6 [root@k8s-master qq-5201351]# kubectl get pod -n kube-system NAME READY STATUS RESTARTS AGE calico-kube-controllers-64cc74d646-w88qt 1/1 Running 0 4m56s calico-node-6x9qg 1/1 Running 0 4m56s calico-node-8wgkl 1/1 Running 0 4m56s calico-node-k56l5 1/1 Running 0 4m56s coredns-6d8c4cb4d-rm26d 1/1 Running 0 29m coredns-6d8c4cb4d-xmzgb 1/1 Running 0 29m etcd-k8s-master 1/1 Running 0 29m kube-apiserver-k8s-master 1/1 Running 0 29m kube-controller-manager-k8s-master 1/1 Running 0 29m kube-proxy-2tzxv 1/1 Running 0 20m kube-proxy-gwvwz 1/1 Running 0 29m kube-proxy-mtwrv 1/1 Running 0 28m kube-scheduler-k8s-master 1/1 Running 0 29m [root@k8s-master qq-5201351]#
至此calico网络组件部署完成~
尊重别人的劳动成果 转载请务必注明出处:https://www.cnblogs.com/5201351/p/17400122.html
标签:...,kube,Kubernetes,system,Running,v1.23,master,k8s,calico From: https://www.cnblogs.com/5201351/p/17400122.html