kubeadm init

来源:1-5 下载Kubeadm,node组件和命令行工具

慕移动4253767

2020-04-15

执行命令:

kubeadm  init --apiserver-advertise-address=114.67.169.108  --pod-network-cidr=192.268.16.0/20  --kubernetes-version=1.10.2
[etcd] Wrote Static Pod manifest for a local etcd instance to "/etc/kubernetes/manifests/etcd.yaml"
[init] Waiting for the kubelet to boot up the control plane as Static Pods from directory "/etc/kubernetes/manifests".
[init] This might take a minute or longer if the control plane images have to be pulled.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10255/healthz' failed with error: Get http://localhost:10255/healthz: dial tcp [::1]:10255: getsockopt: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10255/healthz' failed with error: Get http://localhost:10255/healthz: dial tcp [::1]:10255: getsockopt: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10255/healthz' failed with error: Get http://localhost:10255/healthz: dial tcp [::1]:10255: getsockopt: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10255/healthz/syncloop' failed with error: Get http://localhost:10255/healthz/syncloop: dial tcp [::1]:10255: getsockopt: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10255/healthz/syncloop' failed with error: Get http://localhost:10255/healthz/syncloop: dial tcp [::1]:10255: getsockopt: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10255/healthz/syncloop' failed with error: Get http://localhost:10255/healthz/syncloop: dial tcp [::1]:10255: getsockopt: connection refused.
Unfortunately, an error has occurred:
	timed out waiting for the condition

This error is likely caused by:
	- The kubelet is not running
	- The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)
	- Either there is no internet connection, or imagePullPolicy is set to "Never",
	  so the kubelet cannot pull or find the following control plane images:
		- k8s.gcr.io/kube-apiserver-amd64:v1.10.2
		- k8s.gcr.io/kube-controller-manager-amd64:v1.10.2
		- k8s.gcr.io/kube-scheduler-amd64:v1.10.2
		- k8s.gcr.io/etcd-amd64:3.1.12 (only if no external etcd endpoints are configured)

If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
	- 'systemctl status kubelet'
	- 'journalctl -xeu kubelet'

systemctl status kubelet

● kubelet.service - kubelet: The Kubernetes Node Agent
   Loaded: loaded (/etc/systemd/system/kubelet.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/kubelet.service.d
           └─10-kubeadm.conf
   Active: activating (auto-restart) (Result: exit-code) since 三 2020-04-15 15:39:50 CST; 2s ago
     Docs: http://kubernetes.io/docs/
  Process: 15855 ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_SYSTEM_PODS_ARGS $KUBELET_NETWORK_ARGS $KUBELET_DNS_ARGS $KUBELET_AUTHZ_ARGS $KUBELET_CADVISOR_ARGS $KUBELET_CGROUP_ARGS $KUBELET_CERTIFICATE_ARGS $KUBELET_EXTRA_ARGS (code=exited, status=255)
 Main PID: 15855 (code=exited, status=255)

4月 15 15:39:50 jd systemd[1]: kubelet.service: main process exited, code=exited, status=255/n/a
4月 15 15:39:50 jd systemd[1]: Unit kubelet.service entered failed state.
4月 15 15:39:50 jd systemd[1]: kubelet.service failed.
[root@JD ~]# systemctl status kubelet
● kubelet.service - kubelet: The Kubernetes Node Agent
   Loaded: loaded (/etc/systemd/system/kubelet.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/kubelet.service.d
           └─10-kubeadm.conf
   Active: activating (auto-restart) (Result: exit-code) since 三 2020-04-15 15:40:21 CST; 462ms ago
     Docs: http://kubernetes.io/docs/
  Process: 16005 ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_SYSTEM_PODS_ARGS $KUBELET_NETWORK_ARGS $KUBELET_DNS_ARGS $KUBELET_AUTHZ_ARGS $KUBELET_CADVISOR_ARGS $KUBELET_CGROUP_ARGS $KUBELET_CERTIFICATE_ARGS $KUBELET_EXTRA_ARGS (code=exited, status=255)
 Main PID: 16005 (code=exited, status=255)

4月 15 15:40:21 jd systemd[1]: kubelet.service: main process exited, code=exited, status=255/n/a
4月 15 15:40:21 jd systemd[1]: Unit kubelet.service entered failed state.
4月 15 15:40:21 jd systemd[1]: kubelet.service failed.

执行命令

4月 15 15:40:41 jd kubelet[16103]: I0415 15:40:41.943450   16103 docker_service.go:244] Docker cri networking managed by cni
4月 15 15:40:41 jd kubelet[16103]: I0415 15:40:41.962470   16103 docker_service.go:249] Docker Info: &{ID:NM6S:NP62:SMFB:QQDN:7XVR:WL5D:B4QZ:JODQ:46JU:NOCP:HM7I:ZZW4 Containers:0 ContainersRunning:0 Conta
4月 15 15:40:41 jd kubelet[16103]: F0415 15:40:41.962571   16103 server.go:233] failed to run Kubelet: failed to create kubelet: misconfiguration: kubelet cgroup driver: "systemd" is different from docker
4月 15 15:40:41 jd systemd[1]: kubelet.service: main process exited, code=exited, status=255/n/a
4月 15 15:40:41 jd systemd[1]: Unit kubelet.service entered failed state.
4月 15 15:40:41 jd systemd[1]: kubelet.service failed.
4月 15 15:40:52 jd systemd[1]: kubelet.service holdoff time over, scheduling restart.
4月 15 15:40:52 jd systemd[1]: Started kubelet: The Kubernetes Node Agent.
-- Subject: Unit kubelet.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit kubelet.service has finished starting up.
-- 
-- The start-up result is done.
4月 15 15:40:52 jd systemd[1]: Starting kubelet: The Kubernetes Node Agent...
-- Subject: Unit kubelet.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit kubelet.service has begun starting up.
4月 15 15:40:52 jd kubelet[16151]: Flag --pod-manifest-path has been deprecated, This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/t
4月 15 15:40:52 jd kubelet[16151]: Flag --allow-privileged has been deprecated, will be removed in a future version
4月 15 15:40:52 jd kubelet[16151]: Flag --cluster-dns has been deprecated, This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/a
4月 15 15:40:52 jd kubelet[16151]: Flag --cluster-domain has been deprecated, This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/task
4月 15 15:40:52 jd kubelet[16151]: Flag --authorization-mode has been deprecated, This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/
4月 15 15:40:52 jd kubelet[16151]: Flag --client-ca-file has been deprecated, This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/task
4月 15 15:40:52 jd kubelet[16151]: Flag --cadvisor-port has been deprecated, The default will change to 0 (disabled) in 1.12, and the cadvisor port will be removed entirely in 1.13
4月 15 15:40:52 jd kubelet[16151]: Flag --cgroup-driver has been deprecated, This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks
4月 15 15:40:52 jd kubelet[16151]: I0415 15:40:52.131937   16151 feature_gate.go:226] feature gates: &{{} map[]}
4月 15 15:40:52 jd kubelet[16151]: W0415 15:40:52.136424   16151 cni.go:171] Unable to update cni config: No networks found in /etc/cni/net.d
4月 15 15:40:52 jd kubelet[16151]: I0415 15:40:52.144228   16151 server.go:376] Version: v1.10.2
4月 15 15:40:52 jd kubelet[16151]: I0415 15:40:52.144268   16151 feature_gate.go:226] feature gates: &{{} map[]}
4月 15 15:40:52 jd kubelet[16151]: I0415 15:40:52.144368   16151 plugins.go:89] No cloud provider specified.
4月 15 15:40:52 jd kubelet[16151]: I0415 15:40:52.146868   16151 certificate_store.go:117] Loading cert/key pair from "/var/lib/kubelet/pki/kubelet-client-current.pem".
4月 15 15:40:52 jd kubelet[16151]: I0415 15:40:52.167015   16151 server.go:613] --cgroups-per-qos enabled, but --cgroup-root was not specified.  defaulting to /
4月 15 15:40:52 jd kubelet[16151]: I0415 15:40:52.167215   16151 container_manager_linux.go:242] container manager verified user specified cgroup-root exists: /
4月 15 15:40:52 jd kubelet[16151]: I0415 15:40:52.167223   16151 container_manager_linux.go:247] Creating Container Manager object based on Node Config: {RuntimeCgroupsName: SystemCgroupsName: KubeletCgro
4月 15 15:40:52 jd kubelet[16151]: I0415 15:40:52.167308   16151 container_manager_linux.go:266] Creating device plugin manager: true
4月 15 15:40:52 jd kubelet[16151]: I0415 15:40:52.167338   16151 state_mem.go:36] [cpumanager] initializing new in-memory state store
4月 15 15:40:52 jd kubelet[16151]: I0415 15:40:52.167387   16151 state_mem.go:84] [cpumanager] updated default cpuset: ""
4月 15 15:40:52 jd kubelet[16151]: I0415 15:40:52.167396   16151 state_mem.go:92] [cpumanager] updated cpuset assignments: "map[]"
4月 15 15:40:52 jd kubelet[16151]: I0415 15:40:52.167457   16151 kubelet.go:272] Adding pod path: /etc/kubernetes/manifests
4月 15 15:40:52 jd kubelet[16151]: I0415 15:40:52.167474   16151 kubelet.go:297] Watching apiserver
4月 15 15:40:52 jd kubelet[16151]: E0415 15:40:52.191455   16151 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/config/apiserver.go:47: Failed to list *v1.Pod: Get https://114.67.169.108:6443/api/v1/pods
4月 15 15:40:52 jd kubelet[16151]: E0415 15:40:52.191515   16151 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/kubelet.go:460: Failed to list *v1.Node: Get https://114.67.169.108:6443/api/v1/nodes?field
4月 15 15:40:52 jd kubelet[16151]: E0415 15:40:52.191552   16151 reflector.go:205] k8s.io/kubernetes/pkg/kubelet/kubelet.go:451: Failed to list *v1.Service: Get https://114.67.169.108:6443/api/v1/services
4月 15 15:40:52 jd kubelet[16151]: W0415 15:40:52.191629   16151 kubelet_network.go:139] Hairpin mode set to "promiscuous-bridge" but kubenet is not enabled, falling back to "hairpin-veth"
4月 15 15:40:52 jd kubelet[16151]: I0415 15:40:52.191644   16151 kubelet.go:556] Hairpin mode set to "hairpin-veth"
4月 15 15:40:52 jd kubelet[16151]: W0415 15:40:52.191711   16151 cni.go:171] Unable to update cni config: No networks found in /etc/cni/net.d
4月 15 15:40:52 jd kubelet[16151]: I0415 15:40:52.191740   16151 client.go:75] Connecting to docker on unix:///var/run/docker.sock
4月 15 15:40:52 jd kubelet[16151]: I0415 15:40:52.191750   16151 client.go:104] Start docker client with request timeout=2m0s
4月 15 15:40:52 jd kubelet[16151]: W0415 15:40:52.193837   16151 cni.go:171] Unable to update cni config: No networks found in /etc/cni/net.d
4月 15 15:40:52 jd kubelet[16151]: W0415 15:40:52.205591   16151 cni.go:171] Unable to update cni config: No networks found in /etc/cni/net.d
4月 15 15:40:52 jd kubelet[16151]: I0415 15:40:52.205620   16151 docker_service.go:244] Docker cri networking managed by cni
4月 15 15:40:52 jd kubelet[16151]: I0415 15:40:52.226311   16151 docker_service.go:249] Docker Info: &{ID:NM6S:NP62:SMFB:QQDN:7XVR:WL5D:B4QZ:JODQ:46JU:NOCP:HM7I:ZZW4 Containers:0 ContainersRunning:0 Conta
4月 15 15:40:52 jd kubelet[16151]: F0415 15:40:52.226407   16151 server.go:233] failed to run Kubelet: failed to create kubelet: misconfiguration: kubelet cgroup driver: "systemd" is different from docker
4月 15 15:40:52 jd systemd[1]: kubelet.service: main process exited, code=exited, status=255/n/a
4月 15 15:40:52 jd systemd[1]: Unit kubelet.service entered failed state.
4月 15 15:40:52 jd systemd[1]: kubelet.service failed.

写回答

1回答

tonybai

2020-04-15

亲,你好。问题应该是kubelet配置中cgroup-driver与docker使用的cgroup driver不一致。具体可参考 这个issue : https://github.com/kubernetes/kubernetes/issues/50748 祝学习愉快!

0
0

Kubernetes实战 高可用集群搭建,配置,运维与应用

以生产为目标,原理+操作, Kubernetes结合典型云原生应用

794 学习 · 196 问题

查看课程