Kubernetes – 安装主节点5 – 将pod网络部署到集群

查看集群和pod网络的状态

执行下面的命令来获得集群和pod网络的状态。

[root@qikegu-centos5 ~]# kubectl get node
NAME             STATUS     ROLES    AGE     VERSION
qikegu-centos5   NotReady   master   3h43m   v1.16.2
[root@qikegu-centos5 ~]# kubectl get pods --all-namespaces
NAMESPACE     NAME                                     READY   STATUS    RESTARTS   AGE
kube-system   coredns-58cc8c89f4-6lcfh                 0/1     Pending   0          3h43m
kube-system   coredns-58cc8c89f4-msp4l                 0/1     Pending   0          3h43m
kube-system   etcd-qikegu-centos5                      1/1     Running   2          3h42m
kube-system   kube-apiserver-qikegu-centos5            1/1     Running   2          3h42m
kube-system   kube-controller-manager-qikegu-centos5   1/1     Running   2          3h42m
kube-system   kube-proxy-44xmx                         1/1     Running   2          3h43m
kube-system   kube-scheduler-qikegu-centos5            1/1     Running   2          3h42m
[root@qikegu-centos5 ~]#

可以看到主节点的状态是NotReady,以及Pending项。

部署pod网络

POD网络是工作节点之间的网络,可以部署pod网络,以便不同主机的容器可以彼此通信。

执行以下命令部署pod网络

kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"

输出:

[root@qikegu-centos5 ~]# kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
serviceaccount/weave-net created
clusterrole.rbac.authorization.k8s.io/weave-net created
clusterrolebinding.rbac.authorization.k8s.io/weave-net created
role.rbac.authorization.k8s.io/weave-net created
rolebinding.rbac.authorization.k8s.io/weave-net created
daemonset.apps/weave-net created

再次查看集群和pod网络的状态

[root@qikegu-centos5 ~]# kubectl get nodes
NAME             STATUS   ROLES    AGE    VERSION
qikegu-centos5   Ready    master   4h5m   v1.16.2
[root@qikegu-centos5 ~]# kubectl  get pods  --all-namespaces
NAMESPACE     NAME                                     READY   STATUS      RESTARTS   AGE
kube-system   coredns-58cc8c89f4-6lcfh                 0/1     Completed   0          4h5m
kube-system   coredns-58cc8c89f4-msp4l                 0/1     Completed   0          4h5m
kube-system   etcd-qikegu-centos5                      1/1     Running     3          4h4m
kube-system   kube-apiserver-qikegu-centos5            1/1     Running     3          4h4m
kube-system   kube-controller-manager-qikegu-centos5   1/1     Running     6          4h4m
kube-system   kube-proxy-44xmx                         1/1     Running     3          4h5m
kube-system   kube-scheduler-qikegu-centos5            1/1     Running     6          4h4m
kube-system   weave-net-7bnpw                          1/2     Error       2          14m
[root@qikegu-centos5 ~]#

可以主节点已经是Ready状态,Pending项已经变为Completed

注意 如果出现Unable to connect to the server: net/http: TLS handshake timeout错误,原因可能是内存太小,主节点内存至少2G。



浙ICP备17015664号 浙公网安备 33011002012336号 联系我们 网站地图  
@2019 qikegu.com 版权所有,禁止转载