flannel 和 calico 两个插件都可以,这里我们选择calico,因为相比较calico性能更好一点。

 安装calico指令

kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml

使用上面指令安装出现如下错误:

error: unable to read URL "https://docs.projectcalico.org/manifests/calico.yaml", server reported 404 Not Found, status code=404

这是因为calico的版本和k8s的版本不匹配导致的

解决办法 

curl https://docs.projectcalico.org/v3.18/manifests/calico.yaml -O

kubectl apply -f calico.yaml

校验是否安装成功:

使用 kubectl get pod --all-namespaces 查看各命名空间下的Pod信息

未安装之前信息:

NAMESPACE     NAME                             READY   STATUS    RESTARTS   AGE
kube-system   coredns-6d8c4cb4d-97926          0/1     Pending   0          96m
kube-system   coredns-6d8c4cb4d-c2rt6          0/1     Pending   0          96m
kube-system   etcd-master                      1/1     Running   5          96m
kube-system   kube-apiserver-master            1/1     Running   5          96m
kube-system   kube-controller-manager-master   1/1     Running   7          96m
kube-system   kube-proxy-qgbp2                 1/1     Running   0          96m
kube-system   kube-scheduler-master            1/1     Running   7          96m

安装成功后信息

NAMESPACE     NAME                                       READY   STATUS    RESTARTS   AGE
kube-system   calico-kube-controllers-6cfb54c7bb-88l25   1/1     Running   0          7m44s
kube-system   calico-node-wxqgh                          1/1     Running   0          7m45s
kube-system   coredns-6d8c4cb4d-97926                    1/1     Running   0          107m
kube-system   coredns-6d8c4cb4d-c2rt6                    1/1     Running   0          107m
kube-system   etcd-master                                1/1     Running   5          107m
kube-system   kube-apiserver-master                      1/1     Running   5          107m
kube-system   kube-controller-manager-master             1/1     Running   7          107m
kube-system   kube-proxy-qgbp2                           1/1     Running   0          107m
kube-system   kube-scheduler-master                      1/1     Running   7          107m

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐