在安装 Kubernetes 时,我卡在 CNI 插件安装和配置部分。我已经安装了 Flannel,但由于 coredns pod 处于挂起状态,我在 kubelet 日志中看到错误。
操作系统:Centos7 k8s 版本:1.16 Kubeadm 用于设置集群。
我使用以下方法安装了插件:kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
这是我可以在 Kubelet 日志中看到的错误:
Sep 21 04:47:29 peteelizalde2c kubelet: W0921 04:47:29.897759 17817 cni.go:202] Error validating CNI config &{cbr0 false [0xc000fb3ee0 0xc000fb3f60] [123 10 32 32 34 110 97 109 101 34 58 32 34 99 98 114 48 34 44 10 32 32 34 112 108 117 103 105 110 115 34 58 32 91 10 32 32 32 32 123 10 32 32 32 32 32 32 34 116 121 112 101 34 58 32 34 102 108 97 110 110 101 108 34 44 10 32 32 32 32 32 32 34 100 101 108 101 103 97 116 101 34 58 32 123 10 32 32 32 32 32 32 32 32 34 104 97 105 114 112 105 110 77 111 100 101 34 58 32 116 114 117 101 44 10 32 32 32 32 32 32 32 32 34 105 115 68 101 102 97 117 108 116 71 97 116 101 119 97 121 34 58 32 116 114 117 101 10 32 32 32 32 32 32 125 10 32 32 32 32 125 44 10 32 32 32 32 123 10 32 32 32 32 32 32 34 116 121 112 101 34 58 32 34 112 111 114 116 109 97 112 34 44 10 32 32 32 32 32 32 34 99 97 112 97 98 105 108 105 116 105 101 115 34 58 32 123 10 32 32 32 32 32 32 32 32 34 112 111 114 116 77 97 112 112 105 110 103 115 34 58 32 116 114 117 101 10 32 32 32 32 32 32 125 10 32 32 32 32 125 10 32 32 93 10 125 10]}: [plugin flannel does not support config version ""]
Sep 21 04:47:29 peteelizalde2c kubelet: W0921 04:47:29.897824 17817 cni.go:237] Unable to update cni config: no valid networks found in /etc/cni/net.d
Sep 21 04:47:32 peteelizalde2c kubelet: E0921 04:47:32.007379 17817 kubelet.go:2187] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
这是豆荚:
kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-5644d7b6d9-n4h5x 0/1 Pending 0 114m
kube-system coredns-5644d7b6d9-t2q54 0/1 Pending 0 114m
kube-system etcd-ip-10-29-89-124 1/1 Running 0 113m
kube-system kube-apiserver-ip-10-29-89-124 1/1 Running 0 113m
kube-system kube-controller-manager-ip-10-29-89-124 1/1 Running 0 113m
kube-system kube-flannel-ds-amd64-dqpzj 1/1 Running 0 110m
kube-system kube-proxy-vzlqb 1/1 Running 0 114m
kube-system kube-scheduler-ip-10-29-89-124 1/1 Running 0 113m
有一个文件/etc/cni/net.d
名为10-flannel.conflist
. 它的内容是:
{
"name": "cbr0",
"plugins": [
{
"type": "flannel",
"delegate": {
"hairpinMode": true,
"isDefaultGateway": true
}
},
{
"type": "portmap",
"capabilities": {
"portMappings": true
}
}
]
}