docker - kubernetes installation and kube-dns: open /run/flannel/subnet.env: no such file or directory -
overview
kube-dns can't start (setupnetworkerror) after kubeadm init , network setup:
error syncing pod, skipping: failed "setupnetwork" "kube-dns-654381707-w4mpg_kube-system" setupnetworkerror: "failed setup network pod \"kube-dns-654381707-w4mpg_kube-system(8ffe3172-a739-11e6-871f-000c2912631c)\" using network plugins \"cni\": open /run/flannel/subnet.env: no such file or directory; skipping pod"
kubernetes version
client version: version.info{major:"1", minor:"4", gitversion:"v1.4.4", gitcommit:"3b417cc4ccd1b8f38ff9ec96bb50a81ca0ea9d56", gittreestate:"clean", builddate:"2016-10-21t02:48:38z", goversion:"go1.6.3", compiler:"gc", platform:"linux/amd64"} server version: version.info{major:"1", minor:"4", gitversion:"v1.4.4", gitcommit:"3b417cc4ccd1b8f38ff9ec96bb50a81ca0ea9d56", gittreestate:"clean", builddate:"2016-10-21t02:42:39z", goversion:"go1.6.3", compiler:"gc", platform:"linux/amd64"}
environment
vmware fusion mac
os
name="ubuntu" version="16.04.1 lts (xenial xerus)" id=ubuntu id_like=debian pretty_name="ubuntu 16.04.1 lts" version_id="16.04" home_url="http://www.ubuntu.com/" support_url="http://help.ubuntu.com/" bug_report_url="http://bugs.launchpad.net/ubuntu/" version_codename=xenial ubuntu_codename=xenial
kernel (e.g. uname -a)
linux ubuntu-master 4.4.0-47-generic #68-ubuntu smp wed oct 26 19:39:52 utc 2016 x86_64 x86_64 x86_64 gnu/linux
what problem
kube-system kube-dns-654381707-w4mpg 0/3 containercreating 0 2m firstseen lastseen count subobjectpath type reason message --------- -------- ----- ---- ------------- -------- ------ ------- 3m 3m 1 {default-scheduler } normal scheduled assigned kube-dns-654381707-w4mpg ubuntu-master 2m 1s 177 {kubelet ubuntu-master} warning failedsync error syncing pod, skipping: failed "setupnetwork" "kube-dns-654381707-w4mpg_kube-system" setupnetworkerror: "failed setup network pod \"kube-dns-654381707-w4mpg_kube-system(8ffe3172-a739-11e6-871f-000c2912631c)\" using network plugins \"cni\": open /run/flannel/subnet.env: no such file or directory; skipping pod"
what expected happen
kube-dns running
how reproduce it
root@ubuntu-master:~# kubeadm init running pre-flight checks <master/tokens> generated token: "247a8e.b7c8c1a7685bf204" <master/pki> generated certificate authority key , certificate: issuer: cn=kubernetes | subject: cn=kubernetes | ca: true not before: 2016-11-10 11:40:21 +0000 utc not after: 2026-11-08 11:40:21 +0000 utc public: /etc/kubernetes/pki/ca-pub.pem private: /etc/kubernetes/pki/ca-key.pem cert: /etc/kubernetes/pki/ca.pem <master/pki> generated api server key , certificate: issuer: cn=kubernetes | subject: cn=kube-apiserver | ca: false not before: 2016-11-10 11:40:21 +0000 utc not after: 2017-11-10 11:40:21 +0000 utc alternate names: [172.20.10.4 10.96.0.1 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] public: /etc/kubernetes/pki/apiserver-pub.pem private: /etc/kubernetes/pki/apiserver-key.pem cert: /etc/kubernetes/pki/apiserver.pem <master/pki> generated service account signing keys: public: /etc/kubernetes/pki/sa-pub.pem private: /etc/kubernetes/pki/sa-key.pem <master/pki> created keys , certificates in "/etc/kubernetes/pki" <util/kubeconfig> created "/etc/kubernetes/kubelet.conf" <util/kubeconfig> created "/etc/kubernetes/admin.conf" <master/apiclient> created api client configuration <master/apiclient> created api client, waiting control plane become ready <master/apiclient> control plane components healthy after 14.053453 seconds <master/apiclient> waiting @ least 1 node register , become ready <master/apiclient> first node ready after 0.508561 seconds <master/apiclient> attempting test deployment <master/apiclient> test deployment succeeded <master/discovery> created essential addon: kube-discovery, waiting become ready <master/discovery> kube-discovery ready after 1.503838 seconds <master/addons> created essential addon: kube-proxy <master/addons> created essential addon: kube-dns kubernetes master initialised successfully! can join number of machines running following on each node: kubeadm join --token=247a8e.b7c8c1a7685bf204 172.20.10.4 root@ubuntu-master:~# root@ubuntu-master:~# kubectl pods --all-namespaces namespace name ready status restarts age kube-system dummy-2088944543-eo1ua 1/1 running 0 47s kube-system etcd-ubuntu-master 1/1 running 3 51s kube-system kube-apiserver-ubuntu-master 1/1 running 0 49s kube-system kube-controller-manager-ubuntu-master 1/1 running 3 51s kube-system kube-discovery-1150918428-qmu0b 1/1 running 0 46s kube-system kube-dns-654381707-mv47d 0/3 containercreating 0 44s kube-system kube-proxy-k0k9q 1/1 running 0 44s kube-system kube-scheduler-ubuntu-master 1/1 running 3 51s root@ubuntu-master:~# root@ubuntu-master:~# kubectl apply -f https://git.io/weave-kube daemonset "weave-net" created root@ubuntu-master:~# root@ubuntu-master:~# root@ubuntu-master:~# kubectl pods --all-namespaces namespace name ready status restarts age kube-system dummy-2088944543-eo1ua 1/1 running 0 47s kube-system etcd-ubuntu-master 1/1 running 3 51s kube-system kube-apiserver-ubuntu-master 1/1 running 0 49s kube-system kube-controller-manager-ubuntu-master 1/1 running 3 51s kube-system kube-discovery-1150918428-qmu0b 1/1 running 0 46s kube-system kube-dns-654381707-mv47d 0/3 containercreating 0 44s kube-system kube-proxy-k0k9q 1/1 running 0 44s kube-system kube-scheduler-ubuntu-master 1/1 running 3 51s kube-system weave-net-ja736 2/2 running 0 1h
it looks have configured flannel before running kubeadm init
. can try fix removing flannel (it may sufficient remove config file rm -f /etc/cni/net.d/*flannel*
), it's best start fresh.
Comments
Post a Comment