1.下载kube-flannel.yml
[root@k8smaster ~]# wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
--2023-02-16 09:25:42-- https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.109.133, 185.199.108.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4461 (4.4K) [text/plain]
Saving to: ‘kube-flannel.yml’
100%[==============================================================================================================>] 4,461 --.-K/s in 0s
2023-02-16 09:25:43 (101 MB/s) - ‘kube-flannel.yml’ saved [4461/4461]
2.应用kube-flannel.yml文件得到运行时容器(master上执行)
[root@k8smaster ~]# kubectl apply -f kube-flannel.yml
namespace/kube-flannel created
clusterrole.rbac.authorization.k8s.io/flannel created
clusterrolebinding.rbac.authorization.k8s.io/flannel created
serviceaccount/flannel created
configmap/kube-flannel-cfg created
daemonset.apps/kube-flannel-ds created
3.查看节点状态会变成ready
[root@k8smaster ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8smaster NotReady control-plane,master 24m v1.23.1
k8snode NotReady <none> 19m v1.23.1
以上还没成功,稍等一下
[root@k8smaster ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8smaster Ready control-plane,master 24m v1.23.1
k8snode Ready <none> 19m v1.23.1
4.查看运行时容器POD(一个pod里面运行了多个docker容器)
[root@k8smaster ~]# kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
coredns-6d8c4cb4d-b9b5m 1/1 Running 0 25m
coredns-6d8c4cb4d-bsgx4 1/1 Running 0 25m
etcd-k8smaster 1/1 Running 1 26m
kube-apiserver-k8smaster 1/1 Running 1 26m
kube-controller-manager-k8smaster 1/1 Running 1 26m
kube-proxy-5f2df 1/1 Running 0 21m
kube-proxy-fr9jg 1/1 Running 0 25m
kube-scheduler-k8smaster 1/1 Running 1 26m
k8s部署网络插件
最新推荐文章于 2024-04-10 02:17:19 发布