问题
I'm having some troubles with initializing the master using kubeadm
..
I'm trying to follow https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/ . I installed docker
, kubelet
, kubeadm
and kubectl
.
Now I executed kubeadm init
, but it stops at [init] This might take a minute or longer if the control plane images have to be pulled.
I looked into journalctl
and there I found out that: Unable to update cni config: No networks found in /etc/cni/net.d
and Failed to list *v1.Pod: Get https://10.159.43.30:6443/api/v1/pods?fieldSelector=spec.nodeName%3Deskubernv01&limit=500&resourceVersion=0: dial tcp 10.159.43.30:6443: getsockopt: connection refused
.
I tried to set up weave-net with kubectl apply -f https://git.io/weave-kube
but it cannot connect: The connection to the server localhost:8080 was refused - did you specify the right host or port?
.
I cannot copy admin.conf
file which should allow me to connect from /etc/kubernates
, because kubeadm init
failed so these are not proper files.
I feel like I'm in a loop here and I'm mising something.
I'm out of options right now. Any ideas?
回答1:
I found the way out.
If anyone has a problem like this - check docker logs.
In my case it was proxy which was unset for docker service. To set it I used:
- Create a systemd drop-in directory for the docker service:
$ sudo mkdir -p /etc/systemd/system/docker.service.d
- Create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:
[Service] Environment="HTTP_PROXY=http://proxy.example.com:80/"
Source: https://docs.docker.com/config/daemon/systemd/#httphttps-proxy
回答2:
I solved it by specifying the version [1.9.7-00] when installing kubeadm,kubectl,and kubelet , like this:
# ----- Install kubernetes -----
# kubeadm docs: https://kubernetes.io/docs/setup/independent/install-kubeadm/
echo " "
echo - Installing Kubernetes...
apt-get update && apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update
apt-get install -y kubelet=1.9.7-00 kubeadm=1.9.7-00 kubectl=1.9.7-00
Note the kubelet=1.9.7-00 kubeadm=1.9.7-00 kubectl=1.9.7-00
来源:https://stackoverflow.com/questions/48861798/kubeadm-init-stops-at-image-pulling