调用kubeadm init时kubeadm无法初始化

时间:2019-04-05 09:06:08

标签: kubernetes

我是kubernetes的新手,正在尝试配置kubernetes主节点,我已经在

下安装了kubeadm,kubectl和kubelet。

https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/

但是当我尝试通过输入kubeadm init来启动kubeadm时,它给了我以下错误

[init] Using Kubernetes version: v1.14.0
[preflight] Running pre-flight checks
        [WARNING Firewalld]: no supported init system detected, skipping checking for services
        [WARNING Service-Docker]: no supported init system detected, skipping checking for services
        [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
        [WARNING Service-Kubelet]: no supported init system detected, skipping checking for services
error execution phase preflight: [preflight] Some fatal errors occurred:
        [ERROR FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml]: /etc/kubernetes/manifests/kube-apiserver.yaml already exists
        [ERROR FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml]: /etc/kubernetes/manifests/kube-controller-manager.yaml already exists
        [ERROR FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml]: /etc/kubernetes/manifests/kube-scheduler.yaml already exists
        [ERROR FileAvailable--etc-kubernetes-manifests-etcd.yaml]: /etc/kubernetes/manifests/etcd.yaml already exists
        [ERROR FileContent--proc-sys-net-ipv4-ip_forward]: /proc/sys/net/ipv4/ip_forward contents are not set to 1
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`

2 个答案:

答案 0 :(得分:0)

看来您的系统上有陈旧的数据。要删除该数据(/ etc / kubernetes)目录,请运行:

kubeadm reset

现在,您需要通过以下命令将ip_forward内容设置为1:

echo 1 > /proc/sys/net/ipv4/ip_forward

这应该可以解决您的问题。

答案 1 :(得分:0)

安装kubernetes需要br_netfilter模块。启用此内核模块,以便iptables处理通过网桥的数据包​​以进行过滤和端口转发,并使集群中的kubernetes pod可以相互通信。

运行以下命令以启用br_netfilter内核模块。

#modprobe br_netfilter


#echo '1' > /proc/sys/net/bridge/bridge-nf-call-iptables  

#nano / proc / sys / net / ipv4 / ip_forward

您应该看到0 删除0并写入1