kubeadm init command gives error

1

When I run the following command:

sudo kubeadm init --pod-network-cidr=192.168.0.0/16 --apiserver-advertise-address=192.168.56.101

I get the following error:

[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/

[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull' error execution phase preflight:
[preflight] Some fatal errors occurred:
[ERROR ImagePull]: failed to pull image k8s.gcr.io/etcd:3.3.10: output: Error response from daemon:
Get https://k8s.gcr.io/v2/: dial tcp: lookup k8s.gcr.io: no such host , error: exit status 1
[ERROR ImagePull]: failed to pull image k8s.gcr.io/coredns:1.3.1: output: Error response from daemon: Get https://k8s.gcr.io/v2/: dial tcp: lookup k8s.gcr.io: no such host , error: exit status 1 [preflight] If you know what you are doing, you can make a check non-fatal with --ignore-preflight-errors=...

How can I resolve this issue?

zain

Posted 2019-07-05T06:41:43.857

Reputation: 11

Answers

0

About the [WARNING IsDockerSystemdCheck]:

As per the official documentation it's recommended to use systemd as cgroup driver for both Kubelet and Docker.

To accomplish that, just configure your docker daemon to use "exec-opts": ["native.cgroupdriver=systemd"], and kubeadm will automatically detect the cgroup driver for the kubelet and set it in the /var/lib/kubelet/kubeadm-flags.env file during runtime

Even though it is recommended by the official docs, beware of this issue [#76531] that's is causing increased systemd CPU usage and log flooding. You can find more details in this Server Fault Question.


About the [ERROR ImagePull]:

When you run kubeadm init, by default, it pulls Kubernetes images from k8s.gcr.io.

The k8s.gcr.io: no such host error means that your DNS is unable to resolve the hostname. You need to solve your DNS problem and make sure that the host has an active internet connection during installation.

If you do not have an internet connection, you have to pre-pull the required control-plane images before installing.

Eduardo Baitello

Posted 2019-07-05T06:41:43.857

Reputation: 178