赞
踩
今天运行查询时,发现命令没效果了,如下
# kubectl get nodes
The connection to the server 192.168.118.20:6443 was refused - did you specify the right host or port?
查看日志:
# journalctl -fu kubelet
-- Logs begin at 二 2021-08-24 16:15:04 CST. --
8月 24 16:23:06 k8s-master systemd[1]: Unit kubelet.service entered failed state.
8月 24 16:23:06 k8s-master systemd[1]: kubelet.service failed.
8月 24 16:23:16 k8s-master systemd[1]: kubelet.service holdoff time over, scheduling restart.
8月 24 16:23:16 k8s-master systemd[1]: Stopped kubelet: The Kubernetes Node Agent.
8月 24 16:23:16 k8s-master systemd[1]: Started kubelet: The Kubernetes Node Agent.
8月 24 16:23:16 k8s-master kubelet[3257]: Flag --network-plugin has been deprecated, will be removed along with dockershim.
8月 24 16:23:16 k8s-master kubelet[3257]: E0824 16:23:16.643788 3257 server.go:204] **"Failed to load kubelet config file" err="failed to load Kubelet config file /var/lib/kubelet/config.yaml, error failed to decode: unexpected GroupVersion string: kube/etc/kubelet.d" path="/var/lib/kubelet/config.yaml"**
8月 24 16:23:16 k8s-master systemd[1]: kubelet.service: main process exited, code=exited, status=1/FAILURE
显示/var/lib/kubelet/config.yaml 文件下的
GroupVersion字符串不对,引起kubelet.service无法启动,应该是昨天改动 静态Pod鼠标卡时改了东西,开了备份虚似机查看如下:
apiVersion: kubelet.config.k8s.io/v1beta1
再改回来。
重新启动kubelet.service
# systemctl status kubelet.service ● kubelet.service - kubelet: The Kubernetes Node Agent Loaded: loaded (/usr/lib/systemd/system/kubelet.service; enabled; vendor preset: disabled) Drop-In: /usr/lib/systemd/system/kubelet.service.d └─10-kubeadm.conf Active: active (running) since 二 2021-08-24 16:48:19 CST; 21s ago Docs: https://kubernetes.io/docs/ Main PID: 3498 (kubelet) Tasks: 18 Memory: 88.9M CGroup: /system.slice/kubelet.service ├─3498 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kuberne... ├─5399 /opt/cni/bin/loopback ├─5401 /opt/cni/bin/loopback └─5406 /opt/cni/bin/portmap 。。。。。。。 Hint: Some lines were ellipsized, use -l to show in full.
恢复正常了
# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-master Ready control-plane,master 71d v1.21.3
k8s-node1 Ready <none> 70d v1.21.3
k8s-node2 Ready <none> 69d v1.21.3
/var/lib/kubelet/config.yaml 留个底
# cat /var/lib/kubelet/config.yaml apiVersion: kubelet.config.k8s.io/v1beta1 authentication: anonymous: enabled: false webhook: cacheTTL: 0s enabled: true x509: clientCAFile: /etc/kubernetes/pki/ca.crt authorization: mode: Webhook webhook: cacheAuthorizedTTL: 0s cacheUnauthorizedTTL: 0s cgroupDriver: systemd clusterDNS: - 10.96.0.10 clusterDomain: cluster.local cpuManagerReconcilePeriod: 0s evictionPressureTransitionPeriod: 0s fileCheckFrequency: 0s healthzBindAddress: 127.0.0.1 healthzPort: 10248 httpCheckFrequency: 0s imageMinimumGCAge: 0s kind: KubeletConfiguration logging: {} nodeStatusReportFrequency: 0s nodeStatusUpdateFrequency: 0s rotateCertificates: true runtimeRequestTimeout: 0s shutdownGracePeriod: 0s shutdownGracePeriodCriticalPods: 0s staticPodPath: /etc/kubernetes/manifests streamingConnectionIdleTimeout: 0s syncFrequency: 0s volumeStatsAggPeriod: 0s
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。