最新要闻

广告

手机

iphone11大小尺寸是多少?苹果iPhone11和iPhone13的区别是什么?

iphone11大小尺寸是多少?苹果iPhone11和iPhone13的区别是什么?

警方通报辅警执法直播中被撞飞:犯罪嫌疑人已投案

警方通报辅警执法直播中被撞飞:犯罪嫌疑人已投案

家电

关于Kubernetes-v1.23.6-网络组件-calico的安装部署...|焦点快看

来源:博客园

当 2 个 worker nodes 节点加入到Kubernetes / k8s 集群后,我们去master节点、执行kubectl get nodes 命令就可以看到worker节点了

但是我们会看到无论是master节点、还是worker 节点, STATUS 都会是NotReady, 如下

[root@k8s-master qq-5201351]# kubectl get nodesNAME         STATUS     ROLES                  AGE     VERSIONk8s-master   NotReady   control-plane,master   9m35s   v1.23.6k8s-node1    NotReady                    8m30s   v1.23.6k8s-node2    NotReady                    9s      v1.23.6

我们继续查看 Pod 的状态,也会发现有两个coredns-xxxxxxxxx-xxxxx 的状态,一直是Pending,正是因为POD的状态异常,所以上面的状态才是NotReady


(资料图)

[root@k8s-master qq-5201351]# kubectl get po -ANAMESPACE     NAME                                 READY   STATUS    RESTARTS   AGEkube-system   coredns-6d8c4cb4d-rm26d              0/1     Pending   0          9m26skube-system   coredns-6d8c4cb4d-xmzgb              0/1     Pending   0          9m26skube-system   etcd-k8s-master                      1/1     Running   0          9m40skube-system   kube-apiserver-k8s-master            1/1     Running   0          9m40skube-system   kube-controller-manager-k8s-master   1/1     Running   0          9m40skube-system   kube-proxy-2tzxv                     1/1     Running   0          18skube-system   kube-proxy-gwvwz                     1/1     Running   0          9m26skube-system   kube-proxy-mtwrv                     1/1     Running   0          8m39skube-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 nodesNAME         STATUS   ROLES                  AGE   VERSIONk8s-master   Ready    control-plane,master   29m   v1.23.6k8s-node1    Ready                     28m   v1.23.6k8s-node2    Ready                     20m   v1.23.6[root@k8s-master qq-5201351]# kubectl get pod -n kube-systemNAME                                       READY   STATUS    RESTARTS   AGEcalico-kube-controllers-64cc74d646-w88qt   1/1     Running   0          4m56scalico-node-6x9qg                          1/1     Running   0          4m56scalico-node-8wgkl                          1/1     Running   0          4m56scalico-node-k56l5                          1/1     Running   0          4m56scoredns-6d8c4cb4d-rm26d                    1/1     Running   0          29mcoredns-6d8c4cb4d-xmzgb                    1/1     Running   0          29metcd-k8s-master                            1/1     Running   0          29mkube-apiserver-k8s-master                  1/1     Running   0          29mkube-controller-manager-k8s-master         1/1     Running   0          29mkube-proxy-2tzxv                           1/1     Running   0          20mkube-proxy-gwvwz                           1/1     Running   0          29mkube-proxy-mtwrv                           1/1     Running   0          28mkube-scheduler-k8s-master                  1/1     Running   0          29m[root@k8s-master qq-5201351]#

至此calico网络组件部署完成~

尊重别人的劳动成果 转载请务必注明出处:https://www.cnblogs.com/5201351/p/17400122.html

关键词: