容器运行时网络未就绪:cni config未初始化 [英] Container runtime network not ready: cni config uninitialized
问题描述
我正在在Virtualbox
内运行的centos VM上安装kubernetes(kubeadm),所以用yum我安装了kubeadm, kubelet
和docker
.
I'm installing kubernetes(kubeadm) on centos VM running inside Virtualbox
, so with yum I installed kubeadm, kubelet
and docker
.
现在,当尝试使用kubeadm init --pod-network-cidr=192.168.56.0/24 --apiserver-advertise-address=192.168.56.33/32
设置群集时,我遇到以下错误:
Now while trying to setup cluster with kubeadm init --pod-network-cidr=192.168.56.0/24 --apiserver-advertise-address=192.168.56.33/32
i run into the following error :
Unable to update cni config: No networks found in /etc/cni/net.d
Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
所以我检查了,即使安装了kubernetes-cni-0.6.0-0.x86_64
,在/etc
中也没有cni
文件夹.我尝试在/etc/systemd/system/kubelet.service.d/10-kubeadm.conf
中评论KUBELET_NETWORK_ARGS
,但是没有用.
So I checked, no cni
folder in /etc
even that kubernetes-cni-0.6.0-0.x86_64
is installed. I Tried commenting KUBELET_NETWORK_ARGS
in /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
but it didn't work.
PS:
-
我要在代理后面安装.
I'm installing behind proxy.
我有多个网络适配器:
-
NAT:Internet的10.0.2.15/24
NAT : 10.0.2.15/24 for Internet
仅主机:192.168.56.33/32
Host Only : 192.168.56.33/32
和docker接口:172.17.0.1/16
And docker interface : 172.17.0.1/16
Docker版本:17.12.1-ce
kubectl版本:Major:"1", 次要:"9",GitVersion:"v1.9.3"
Centos 7
Docker version: 17.12.1-ce
kubectl version : Major:"1", Minor:"9", GitVersion:"v1.9.3"
Centos 7
推荐答案
使用"kubeadm init"设置集群时要记住几点,并且在Kubernetes站点上有明确记录
There are several points to remember when setting up the cluster with "kubeadm init" and it is clearly documented on the Kubernetes site kubeadm cluster create:
- "kubeadm重置"(如果您已经创建了以前的集群)
- 从主目录或根目录中删除".kube"文件夹
- (也可以使用systemctl停止kubelet,以实现平滑的设置)
- 永久禁用计算机上的交换,尤其是在重新启动linux系统时
- 不要忘记,安装
- "kubeadm reset" if you have already created a previous cluster
- Remove the ".kube" folder from the home or root directory
- (Also stopping the kubelet with systemctl will allow for a smooth setup)
- Disable swap permanently on the machine, especially if you are rebooting your linux system
- And not to forget, install a pod network add-on according to the instructions provided on the add on site (not Kubernetes site)
- Follow the post initialization steps given on the command window by kubeadm.
如果正确执行了所有这些步骤,则您的集群将正常运行.
If all these steps are followed correctly then your cluster will run properly.
不要忘记执行以下命令以在创建的集群上启用调度:
And don't forget to do the following command to enable scheduling on the created cluster:
kubectl taint nodes --all node-role.kubernetes.io/master-
关于如何从代理后面进行安装,您可能会发现这很有用:
About how to install from behind proxy you may find this useful:
这篇关于容器运行时网络未就绪:cni config未初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!