![Kubenet 没有 netConfig](https://linux22.com/image/705852/Kubenet%20%E6%B2%A1%E6%9C%89%20netConfig.png)
我已经设置了一个带有 CNI 的 kubernetes 集群,用于网络、RBAC 和 TLS 连接。我在准备节点方面花了几个小时的时间。
root@master ~ # kubectl get nodes
NAME STATUS AGE VERSION
us1-worker-node01 NotReady 3h v1.6.1
us1-worker-node02 NotReady 3h v1.6.1
该错误似乎来自 kubelet
[...]
juin 14 13:54:03 us1-worker-node01 kubelet[19570]: I0614 13:54:03.192345 19570 manager.go:288] Starting recovery of all containers
juin 14 13:54:03 us1-worker-node01 kubelet[19570]: I0614 13:54:03.239022 19570 manager.go:293] Recovery completed
juin 14 13:54:02 us1-worker-node01 kubelet[19570]: I0614 13:54:02.754864 19570 kubelet_node_status.go:230] Setting node annotation to enable volume controller attach/detach
juin 14 13:54:02 us1-worker-node01 kubelet[19570]: I0614 13:54:02.760381 19570 kubelet_node_status.go:379] Recording NodeHasSufficientDisk event message for node us1-worker-node01
juin 14 13:54:02 us1-worker-node01 kubelet[19570]: I0614 13:54:02.760566 19570 kubelet_node_status.go:379] Recording NodeHasSufficientMemory event message for node us1-worker-node01
juin 14 13:54:02 us1-worker-node01 kubelet[19570]: I0614 13:54:02.760721 19570 kubelet_node_status.go:379] Recording NodeHasNoDiskPressure event message for node us1-worker-node01
juin 14 13:54:02 us1-worker-node01 kubelet[19570]: I0614 13:54:02.760872 19570 kubelet_node_status.go:77] Attempting to register node us1-worker-node01
juin 14 13:54:02 us1-worker-node01 kubelet[19570]: I0614 13:54:02.791650 19570 kubelet_node_status.go:128] Node us1-worker-node01 was previously registered
juin 14 13:54:02 us1-worker-node01 kubelet[19570]: I0614 13:54:02.791837 19570 kubelet_node_status.go:80] Successfully registered node us1-worker-node01
juin 14 13:54:08 us1-worker-node01 kubelet[19570]: I0614 13:54:08.171841 19570 kubelet.go:1808] SyncLoop (ADD, "api"): ""
juin 14 13:54:07 us1-worker-node01 kubelet[19570]: E0614 13:54:07.778441 19570 kubelet.go:2067] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: Kubenet does not have netConfig. This is most likely due to lack of PodCIDR
juin 14 13:54:12 us1-worker-node01 kubelet[19570]: E0614 13:54:12.779166 19570 kubelet.go:2067] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: Kubenet does not have netConfig. This is most likely due to lack of PodCIDR
juin 14 13:54:17 us1-worker-node01 kubelet[19570]: E0614 13:54:17.781032 19570 kubelet.go:2067] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: Kubenet does not have netConfig. This is most likely due to lack of PodCIDR
juin 14 13:54:22 us1-worker-node01 kubelet[19570]: E0614 13:54:22.783057 19570 kubelet.go:2067] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: Kubenet does not have netConfig. This is most likely due to lack of PodCIDR
juin 14 13:54:27 us1-worker-node01 kubelet[19570]: E0614 13:54:27.783449 19570 kubelet.go:2067] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: Kubenet does not have netConfig. This is most likely due to lack of PodCIDR
最后一个错误又一次重复......
这是 kubelet 服务的配置
[Unit]
Description=Kubernetes Kubelet
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
After=docker.service
Requires=docker.service
[Service]
ExecStart=/usr/local/bin/kubelet \
--allow-privileged=true \
--cluster-dns=10.250.0.10 \
--cluster-domain=cluster.local \
--container-runtime=docker \
--network-plugin=kubenet \
--kubeconfig=/var/lib/kubelet/kubelet.kubeconfig \
--serialize-image-pulls=false \
--register-node=true \
--require-kubeconfig \
--tls-cert-file=/var/lib/kubelet/kubelet-client.pem \
--tls-private-key-file=/var/lib/kubelet/kubelet-client.key \
--v=2
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target
CNI 二进制文件安装在 /opt/cni/bin 中。Kubelet 主题证书是CN=系统:节点:us1-worker-node01,O=系统:节点,OU=集群
有任何想法吗 ?
答案1
好的...
kube-controller-manager 无法访问以下选项的 CA.key: --服务帐户私钥文件和--集群签名密钥文件
有了好的CA.key,就不再有问题了!