我有一个主节点和两个节点来构建kubernetes
集群。两个节点都成功加入了主节点(根据控制台日志)。但是,当我运行kubectl get nodes
时,它仅是show master。
在主菜单上ip a
我按照以下步骤运行以初始化集群
kubeadm init --apiserver-advertise-address=192.168.56.8 --pod-network-cidr=10.244.0.0/16
集群成功启动,我申请了flannel
。
节点加入母版
然后我检查nodes
和所有pods
这里有什么问题吗?即使Node
成功加入集群,也仅显示master
--pod-network-cidr
是否正确?
kubeadm init --apiserver-advertise-address=192.168.56.8 --pod-network-cidr=10.244.0.0/16
更新
systemctl status kubelet
on master
[root@localhost ~]# systemctl status kubelet
● kubelet.service - kubelet: The Kubernetes Node Agent
Loaded: loaded (/etc/systemd/system/kubelet.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/kubelet.service.d
└─10-kubeadm.conf
Active: active (running) since Tue 2019-02-19 02:10:31 EST; 3min 20s ago
Docs: https://kubernetes.io/docs/
Main PID: 2099 (kubelet)
Tasks: 17
Memory: 37.3M
CGroup: /system.slice/kubelet.service
└─2099 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --cgroup-driver=cgroupfs -...
Feb 19 02:13:48 localhost.localdomain kubelet[2099]: W0219 02:13:48.423482 2099 kubelet.go:1647] Deleting mirror pod "kube-apiserver-localhost.localdomain_kube-system(e5b3349f-3415-11e9-9...t is outdated
Feb 19 02:13:48 localhost.localdomain kubelet[2099]: W0219 02:13:48.423758 2099 kubelet.go:1647] Deleting mirror pod "etcd-localhost.localdomain_kube-system(e5b30354-3415-11e9-9138-080027...t is outdated
Feb 19 02:13:48 localhost.localdomain kubelet[2099]: W0219 02:13:48.423926 2099 kubelet.go:1647] Deleting mirror pod "kube-scheduler-localhost.localdomain_kube-system(e5b31fd5-3415-11e9-9...t is outdated
Feb 19 02:13:48 localhost.localdomain kubelet[2099]: W0219 02:13:48.424101 2099 kubelet.go:1647] Deleting mirror pod "kube-controller-manager-localhost.localdomain_kube-system(e5b32acb-34...t is outdated
Feb 19 02:13:50 localhost.localdomain kubelet[2099]: W0219 02:13:50.431977 2099 kubelet.go:1647] Deleting mirror pod "kube-scheduler-localhost.localdomain_kube-system(e6e55cb5-3415-11e9-9...t is outdated
Feb 19 02:13:50 localhost.localdomain kubelet[2099]: W0219 02:13:50.432249 2099 kubelet.go:1647] Deleting mirror pod "kube-apiserver-localhost.localdomain_kube-system(e6e56f52-3415-11e9-9...t is outdated
Feb 19 02:13:50 localhost.localdomain kubelet[2099]: W0219 02:13:50.432406 2099 kubelet.go:1647] Deleting mirror pod "kube-controller-manager-localhost.localdomain_kube-system(e6e59401-34...t is outdated
Feb 19 02:13:50 localhost.localdomain kubelet[2099]: W0219 02:13:50.432560 2099 kubelet.go:1647] Deleting mirror pod "etcd-localhost.localdomain_kube-system(e6e5802e-3415-11e9-9138-080027...t is outdated
Feb 19 02:13:51 localhost.localdomain kubelet[2099]: W0219 02:13:51.977049 2099 cni.go:203] Unable to update cni config: No networks found in /etc/cni/net.d
Feb 19 02:13:51 localhost.localdomain kubelet[2099]: E0219 02:13:51.977207 2099 kubelet.go:2192] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady messa...uninitialized
Hint: Some lines were ellipsized, use -l to show in full.
journalctl -u kubelet
on master
[root@localhost ~]# journalctl -u kubelet
-- Logs begin at Tue 2019-02-19 01:31:20 EST, end at Tue 2019-02-19 02:14:27 EST. --
Feb 19 01:39:11 localhost.localdomain systemd[1]: Started kubelet: The Kubernetes Node Agent.
Feb 19 01:39:11 localhost.localdomain kubelet[13181]: Flag --cgroup-driver has been deprecated, This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kuberne
Feb 19 01:39:11 localhost.localdomain kubelet[13181]: Flag --cgroup-driver has been deprecated, This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kuberne
Feb 19 01:39:11 localhost.localdomain kubelet[13181]: F0219 01:39:11.716907 13181 server.go:244] unable to load client CA file /etc/kubernetes/pki/ca.crt: open /etc/kubernetes/pki/ca.crt: no such file or
Feb 19 01:39:11 localhost.localdomain systemd[1]: kubelet.service: main process exited, code=exited, status=255/n/a
Feb 19 01:39:11 localhost.localdomain systemd[1]: Unit kubelet.service entered failed state.
Feb 19 01:39:11 localhost.localdomain systemd[1]: kubelet.service failed.
Feb 19 01:39:21 localhost.localdomain systemd[1]: kubelet.service holdoff time over, scheduling restart.
Feb 19 01:39:21 localhost.localdomain systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
Feb 19 01:39:21 localhost.localdomain systemd[1]: Started kubelet: The Kubernetes Node Agent.
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: Flag --cgroup-driver has been deprecated, This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kuberne
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: Flag --cgroup-driver has been deprecated, This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kuberne
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.050655 13189 server.go:407] Version: v1.13.3
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.050858 13189 plugins.go:103] No cloud provider specified.
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: E0219 01:39:22.065072 13189 certificate_manager.go:348] Failed while requesting a signed certificate from the master: cannot create certificate signin
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.110331 13189 server.go:666] --cgroups-per-qos enabled, but --cgroup-root was not specified. defaulting to /
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.110567 13189 container_manager_linux.go:248] container manager verified user specified cgroup-root exists: []
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.110585 13189 container_manager_linux.go:253] Creating Container Manager object based on Node Config: {RuntimeCgroupsName: SystemCgroups
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.110663 13189 container_manager_linux.go:272] Creating device plugin manager: true
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.110721 13189 state_mem.go:36] [cpumanager] initializing new in-memory state store
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.111976 13189 kubelet.go:281] Adding pod path: /etc/kubernetes/manifests
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.112038 13189 kubelet.go:306] Watching apiserver
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.114437 13189 client.go:75] Connecting to docker on unix:///var/run/docker.sock
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.114454 13189 client.go:104] Start docker client with request timeout=2m0s
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: E0219 01:39:22.115604 13189 reflector.go:134] k8s.io/kubernetes/pkg/kubelet/kubelet.go:453: Failed to list *v1.Node: Get https://192.168.56.8:6443/api
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: E0219 01:39:22.115643 13189 reflector.go:134] k8s.io/kubernetes/pkg/kubelet/kubelet.go:444: Failed to list *v1.Service: Get https://192.168.56.8:6443/
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: E0219 01:39:22.115721 13189 reflector.go:134] k8s.io/kubernetes/pkg/kubelet/config/apiserver.go:47: Failed to list *v1.Pod: Get https://192.168.56.8:6
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: W0219 01:39:22.116751 13189 docker_service.go:540] Hairpin mode set to "promiscuous-bridge" but kubenet is not enabled, falling back to "hairpin-veth"
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.116765 13189 docker_service.go:236] Hairpin mode set to "hairpin-veth"
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: W0219 01:39:22.116832 13189 cni.go:203] Unable to update cni config: No networks found in /etc/cni/net.d
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: W0219 01:39:22.119472 13189 cni.go:203] Unable to update cni config: No networks found in /etc/cni/net.d
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.119494 13189 docker_service.go:251] Docker cri networking managed by cni
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.139202 13189 docker_service.go:256] Docker Info: &{ID:ROIM:X2IR:DVOT:SQNQ:Z2F6:LH72:VGRC:FSH4:YMBJ:SJWP:RF4S:JY45 Containers:0 Containe
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.139261 13189 docker_service.go:269] Setting cgroupDriver to cgroupfs
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.163372 13189 kuberuntime_manager.go:198] Container runtime docker initialized, version: 18.09.2, apiVersion: 1.39.0
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.167199 13189 server.go:999] Started kubelet
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: E0219 01:39:22.167526 13189 kubelet.go:1308] Image garbage collection failed once. Stats initialization may not have completed yet: failed to get imag
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.167913 13189 fs_resource_analyzer.go:66] Starting FS ResourceAnalyzer
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.167935 13189 status_manager.go:152] Starting to sync pod status with apiserver
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.167944 13189 kubelet.go:1829] Starting kubelet main sync loop.
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.167954 13189 kubelet.go:1846] skipping pod synchronization - [container runtime status check may not have completed yet PLEG is not hea
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.168027 13189 server.go:137] Starting to listen on 0.0.0.0:10250
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.168439 13189 server.go:333] Adding debug handlers to kubelet server.
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.169114 13189 volume_manager.go:248] Starting Kubelet Volume Manager
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: E0219 01:39:22.169500 13189 event.go:212] Unable to write event: 'Post https://192.168.56.8:6443/api/v1/namespaces/default/events: dial tcp 192.168.56
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.169922 13189 desired_state_of_world_populator.go:130] Desired state populator starts to run
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: W0219 01:39:22.171070 13189 cni.go:203] Unable to update cni config: No networks found in /etc/cni/net.d
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: E0219 01:39:22.171245 13189 kubelet.go:2192] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: netw
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: E0219 01:39:22.269826 13189 kubelet.go:2266] node "localhost.localdomain" not found
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.269846 13189 kubelet.go:1846] skipping pod synchronization - [container runtime status check may not have completed yet]
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.269867 13189 kubelet_node_status.go:278] Setting node annotation to enable volume controller attach/detach
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.272256 13189 kubelet_node_status.go:72] Attempting to register node localhost.localdomain
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: E0219 01:39:22.272472 13189 kubelet_node_status.go:94] Unable to register node "localhost.localdomain" with API server: Post https://192.168.56.8:6443
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.277225 13189 kubelet_node_status.go:278] Setting node annotation to enable volume controller attach/detach
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.278536 13189 cpu_manager.go:155] [cpumanager] starting with none policy
Feb 19 01:39:22 localhost.localdomain kubelet[13189]: I0219 01:39:22.278544 13189 cpu_manager.go:156] [cpumanager] reconciling every 10s
节点上的状态
[root@localhost ~]# 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: active (running) since Tue 2019-02-19 02:13:23 EST; 5min ago
Docs: https://kubernetes.io/docs/
Main PID: 14859 (kubelet)
Tasks: 16
Memory: 36.3M
CGroup: /system.slice/kubelet.service
└─14859 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --cgroup-driver=cgroupfs ...
Feb 19 02:18:25 localhost.localdomain kubelet[14859]: E0219 02:18:25.598922 14859 generic.go:277] PLEG: pod kube-proxy-4z575/kube-system failed reinspection: rpc error: code = Unknown desc...alid argument
Feb 19 02:18:26 localhost.localdomain kubelet[14859]: E0219 02:18:26.602125 14859 kuberuntime_manager.go:857] PodSandboxStatus of sandbox "2d9acc379432bdae0c9de5e6d99d26b8ea6e450a19767bd231778febef9aff...
Feb 19 02:18:26 localhost.localdomain kubelet[14859]: E0219 02:18:26.602146 14859 generic.go:247] PLEG: Ignoring events for pod kube-proxy-4z575/kube-system: rpc error: code = Unknown desc...alid argument
Feb 19 02:18:26 localhost.localdomain kubelet[14859]: E0219 02:18:26.603365 14859 kuberuntime_manager.go:857] PodSandboxStatus of sandbox "2d9acc379432bdae0c9de5e6d99d26b8ea6e450a19767bd231778febef9aff...
Feb 19 02:18:26 localhost.localdomain kubelet[14859]: E0219 02:18:26.603385 14859 generic.go:277] PLEG: pod kube-proxy-4z575/kube-system failed reinspection: rpc error: code = Unknown desc...alid argument
Feb 19 02:18:27 localhost.localdomain kubelet[14859]: E0219 02:18:27.606248 14859 kuberuntime_manager.go:857] PodSandboxStatus of sandbox "2d9acc379432bdae0c9de5e6d99d26b8ea6e450a19767bd231778febef9aff...
Feb 19 02:18:27 localhost.localdomain kubelet[14859]: E0219 02:18:27.606270 14859 generic.go:247] PLEG: Ignoring events for pod kube-proxy-4z575/kube-system: rpc error: code = Unknown desc...alid argument
Feb 19 02:18:27 localhost.localdomain kubelet[14859]: E0219 02:18:27.607863 14859 kuberuntime_manager.go:857] PodSandboxStatus of sandbox "2d9acc379432bdae0c9de5e6d99d26b8ea6e450a19767bd231778febef9aff...
Feb 19 02:18:27 localhost.localdomain kubelet[14859]: E0219 02:18:27.607880 14859 generic.go:277] PLEG: pod kube-proxy-4z575/kube-system failed reinspection: rpc error: code = Unknown desc...alid argument
Feb 19 02:18:27 localhost.localdomain kubelet[14859]: E0219 02:18:27.809433 14859 pod_workers.go:190] Error syncing pod 84186094-3415-11e9-9138-080027621cd9 ("kube-proxy-4z575_kube-system(84186094-3415...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# journalctl -u kubelet
-- Logs begin at Tue 2019-02-19 01:31:23 EST, end at Tue 2019-02-19 02:19:06 EST. --
Feb 19 01:31:30 localhost.localdomain systemd[1]: Started kubelet: The Kubernetes Node Agent.
Feb 19 01:31:31 localhost.localdomain kubelet[2802]: F0219 01:31:31.353952 2802 server.go:189] failed to load Kubelet config file /var/lib/kubelet/config.yaml, error failed to read kubelet config file "/
Feb 19 01:31:31 localhost.localdomain systemd[1]: kubelet.service: main process exited, code=exited, status=255/n/a
Feb 19 01:31:31 localhost.localdomain systemd[1]: Unit kubelet.service entered failed state.
Feb 19 01:31:31 localhost.localdomain systemd[1]: kubelet.service failed.
Feb 19 01:31:41 localhost.localdomain systemd[1]: kubelet.service holdoff time over, scheduling restart.
Feb 19 01:31:41 localhost.localdomain systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
Feb 19 01:31:41 localhost.localdomain systemd[1]: Started kubelet: The Kubernetes Node Agent.
Feb 19 01:31:41 localhost.localdomain kubelet[7337]: F0219 01:31:41.829265 7337 server.go:189] failed to load Kubelet config file /var/lib/kubelet/config.yaml, error failed to read kubelet config file "/
Feb 19 01:31:41 localhost.localdomain systemd[1]: kubelet.service: main process exited, code=exited, status=255/n/a
Feb 19 01:31:41 localhost.localdomain systemd[1]: Unit kubelet.service entered failed state.
Feb 19 01:31:41 localhost.localdomain systemd[1]: kubelet.service failed.
Feb 19 01:31:52 localhost.localdomain systemd[1]: kubelet.service holdoff time over, scheduling restart.
Feb 19 01:31:52 localhost.localdomain systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
Feb 19 01:31:52 localhost.localdomain systemd[1]: Started kubelet: The Kubernetes Node Agent.
Feb 19 01:31:52 localhost.localdomain systemd[1]: kubelet.service: main process exited, code=exited, status=255/n/a
Feb 19 01:31:52 localhost.localdomain kubelet[11899]: F0219 01:31:52.188858 11899 server.go:189] failed to load Kubelet config file /var/lib/kubelet/config.yaml, error failed to read kubelet config file "
Feb 19 01:31:52 localhost.localdomain systemd[1]: Unit kubelet.service entered failed state.
Feb 19 01:31:52 localhost.localdomain systemd[1]: kubelet.service failed.
Feb 19 01:32:02 localhost.localdomain systemd[1]: kubelet.service holdoff time over, scheduling restart.
Feb 19 01:32:02 localhost.localdomain systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
Feb 19 01:32:02 localhost.localdomain systemd[1]: Started kubelet: The Kubernetes Node Agent.
Feb 19 01:32:02 localhost.localdomain kubelet[13110]: F0219 01:32:02.524046 13110 server.go:189] failed to load Kubelet config file /var/lib/kubelet/config.yaml, error failed to read kubelet config file "
Feb 19 01:32:02 localhost.localdomain systemd[1]: kubelet.service: main process exited, code=exited, status=255/n/a
Feb 19 01:32:02 localhost.localdomain systemd[1]: Unit kubelet.service entered failed state.
Feb 19 01:32:02 localhost.localdomain systemd[1]: kubelet.service failed.
Feb 19 01:32:12 localhost.localdomain systemd[1]: kubelet.service holdoff time over, scheduling restart.
Feb 19 01:32:12 localhost.localdomain systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
Feb 19 01:32:12 localhost.localdomain systemd[1]: Started kubelet: The Kubernetes Node Agent.
Feb 19 01:32:12 localhost.localdomain kubelet[13117]: F0219 01:32:12.854182 13117 server.go:189] failed to load Kubelet config file /var/lib/kubelet/config.yaml, error failed to read kubelet config file "
Feb 19 01:32:12 localhost.localdomain systemd[1]: kubelet.service: main process exited, code=exited, status=255/n/a
Feb 19 01:32:12 localhost.localdomain systemd[1]: Unit kubelet.service entered failed state.
Feb 19 01:32:12 localhost.localdomain systemd[1]: kubelet.service failed.
Feb 19 01:32:23 localhost.localdomain systemd[1]: kubelet.service holdoff time over, scheduling restart.
Feb 19 01:32:23 localhost.localdomain systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
Feb 19 01:32:23 localhost.localdomain systemd[1]: Started kubelet: The Kubernetes Node Agent.
Feb 19 01:32:23 localhost.localdomain kubelet[13124]: F0219 01:32:23.098681 13124 server.go:189] failed to load Kubelet config file /var/lib/kubelet/config.yaml, error failed to read kubelet config file "
Feb 19 01:32:23 localhost.localdomain systemd[1]: kubelet.service: main process exited, code=exited, status=255/n/a
Feb 19 01:32:23 localhost.localdomain systemd[1]: Unit kubelet.service entered failed state.
Feb 19 01:32:23 localhost.localdomain systemd[1]: kubelet.service failed.
Feb 19 01:32:33 localhost.localdomain systemd[1]: kubelet.service holdoff time over, scheduling restart.
Feb 19 01:32:33 localhost.localdomain systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
Feb 19 01:32:33 localhost.localdomain systemd[1]: Started kubelet: The Kubernetes Node Agent.
Feb 19 01:32:33 localhost.localdomain kubelet[13132]: F0219 01:32:33.350274 13132 server.go:189] failed to load Kubelet config file /var/lib/kubelet/config.yaml, error failed to read kubelet config file "
Feb 19 01:32:33 localhost.localdomain systemd[1]: kubelet.service: main process exited, code=exited, status=255/n/a
Feb 19 01:32:33 localhost.localdomain systemd[1]: Unit kubelet.service entered failed state.
Feb 19 01:32:33 localhost.localdomain systemd[1]: kubelet.service failed.
Feb 19 01:32:43 localhost.localdomain systemd[1]: kubelet.service holdoff time over, scheduling restart.
Feb 19 01:32:43 localhost.localdomain systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
Feb 19 01:32:43 localhost.localdomain systemd[1]: Started kubelet: The Kubernetes Node Agent.
Feb 19 01:32:43 localhost.localdomain kubelet[13140]: F0219 01:32:43.602227 13140 server.go:189] failed to load Kubelet config file /var/lib/kubelet/config.yaml, error failed to read kubelet config file "
Feb 19 01:32:43 localhost.localdomain systemd[1]: kubelet.service: main process exited, code=exited, status=255/n/a
Feb 19 01:32:43 localhost.localdomain systemd[1]: Unit kubelet.service entered failed state.
Feb 19 01:32:43 localhost.localdomain systemd[1]: kubelet.service failed.
Feb 19 01:32:53 localhost.localdomain systemd[1]: kubelet.service holdoff time over, scheduling restart.
Feb 19 01:32:53 localhost.localdomain systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
答案 0 :(得分:1)
您需要将节点主机名更改为其他名称,而不是localhost,因为kubelet会根据主机名进行解析,并且不能是localhost。在kubeadm中执行此操作的方法是使用--node-name
参数。
--node-name
参数不能单独使用,您需要在kubelete confs中提供--hostname-override
选项。那只有它能起作用
因此,您在KUBELET_EXTRA_ARGS
处的kubelet额外args(/etc/systemd/system/kubelet.service.d/10-kubeadm.conf
)应该为--hostname-override=<name>
。除此之外,在运行初始化集群时,它还应该是:
kubeadm init --apiserver-advertise-address=192.168.56.8 --pod-network-cidr=10.244.0.0/16 --node-name=<name>
您还需要在工作节点kubelet.conf上使用--hostname-override
,并在join命令上使用--node-name
。
答案 1 :(得分:0)
问题出在主机名上。本地主机名不能在群集中工作。 用唯一的名称更正主机名。