kubeadm fails to initialize when kubeadm init is called

4/5/2019

I am new to kubernetes and trying to configure kubernetes master node, I have installed kubeadm, kubectl and kubelet following

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

but when I try to start kubeadm by typing kubeadm init, it gives me the following error

[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=...`
-- abhishek
kubeadm
kubernetes

2 Answers

4/5/2019

It seems you have stale data present on the system. To remove that data (/etc/kubernetes) directory run:

kubeadm reset

Now you need to set ip_forward content with 1 by following command:

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

This should resolve your issue.

-- Prafull Ladha
Source: StackOverflow

4/5/2019

The br_netfilter module is required for kubernetes installation. Enable this kernel module so that the packets traversing the bridge are processed by iptables for filtering and for port forwarding, and the kubernetes pods across the cluster can communicate with each other.

Run the command below to enable the br_netfilter kernel module.

#modprobe br_netfilter


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

or

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

you should see 0 delete 0 and write 1

-- yasin lachini
Source: StackOverflow