api-server-pod-重啟失敗

菜阿發表於2024-11-06

目錄
  • api-server-pod-重啟失敗
    • 錯誤日誌
      • kubelet
      • api-server-pod
      • 網路卡裝置缺失
    • 原因分析
    • 解決:

api-server-pod-重啟失敗

錯誤日誌

kubelet

apiserver.go:42] "Waiting for node sync before watching apiserver pods"<br/>11月 05 19:22:18 k8s.master kubelet[845]: E1105 19:22:18.852473     845 reflector.go:138] k8s.io/client-go/informers/factory.go:134: Failed to watch *v1.Service: failed to list *v1.Service: Get "https://lb.kubesphere.local:6443/api/v1/services?limit=500&resourceVersion=0": dial tcp 10.191.9.21:6443: connect: connection refused<br/>11月 05 19:22:18 k8s.master kubelet[845]: E1105 19:22:18.852493     845 reflector.go:138] k8s.io/client-go/informers/factory.go:134: Failed to watch *v1.Node: failed to list *v1.Node: Get "https://lb.kubesphere.local:6443/api/v1/nodes?fieldSelector=metadata.name%3Dk8s.master&limit=500&resourceVersion=0": dial tcp 10.191.9.21:6443<br/>11月 05 19:22:18 k8s.master kubelet[845]: I1105 19:22:18.871794     845 kuberuntime_manager.go:222] "Container runtime initialized" containerRuntime="docker" version="24.0.6" apiVersion="1.43.0"<br/>11月 05 19:22:19 k8s.master kubelet[845]: E1105 19:22:19.156476     845 aws_credentials.go:77] while getting AWS credentials NoCredentialProviders: no valid providers in chain. Deprecated.<br/>11月 05 19:22:19 k8s.master kubelet[845]: For verbose messaging see aws.Config.CredentialsChainVerboseErrors<br/>11月 05 19:22:19 k8s.master kubelet[845]: I1105 19:22:19.164642     845 server.go:1190] "Started kubelet"<br/>11月 05 19:22:19 k8s.master kubelet[845]: E1105 19:22:19.165838     845 kubelet.go:1306] "Image garbage collection failed once. Stats initialization may not have completed yet" err="failed to get imageFs info: unable to find data in memory cache"<br/>11月 05 19:22:19 k8s.master kubelet[845]: I1105 19:22:19.168787     845 server.go:149] "Starting to listen" address="0.0.0.0" port=10250<br/>11月 05 19:22:19 k8s.master kubelet[845]: I1105 19:22:19.169208     845 fs_resource_analyzer.go:67] "Starting FS ResourceAnalyzer"<br/>11月 05 19:22:19 k8s.master kubelet[845]: I1105 19:22:19.171173     845 volume_manager.go:279] "Starting Kubelet Volume Manager"<br/>11月 05 19:22:19 k8s.master kubelet[845]: I1105 19:22:19.171983     845 desired_state_of_world_populator.go:141] "Desired state populator starts to run"<br/>11月 05 19:22:19 k8s.master kubelet[845]: E1105 19:22:19.175230     845 event.go:273] Unable to write event: '&v1.Event{TypeMeta:v1.TypeMeta{Kind:"", APIVersion:""}, ObjectMeta:v1.ObjectMeta{Name:"k8s.master.18050ea64a1af988", GenerateName:"", Namespace:"default", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTim<br/>11月 05 19:22:19 k8s.master kubelet[845]: E1105 19:22:19.176214     845 controller.go:144] failed to ensure lease exists, will retry in 200ms, error: Get "https://lb.kubesphere.local:6443/apis/coordination.k8s.io/v1/namespaces/kube-node-lease/leases/k8s.master?timeout=10s": dial tcp 10.191.9.21:6443: connect: connection refused<br/>11月 05 19:22:19 k8s.master kubelet[845]: E1105 19:22:19.175392     845 reflector.go:138] k8s.io/client-go/informers/factory.go:134: Failed to watch *v1.CSIDriver: failed to list *v1.CSIDriver: Get "https://lb.kubesphere.local:6443/apis/storage.k8s.io/v1/csidrivers?limit=500&resourceVersion=0": dial tcp 10.191.9.21:6443: connect:<br/>11月 05 19:22:19 k8s.master kubelet[845]: I1105 19:22:19.210838     845 server.go:409] "Adding debug handlers to kubelet server"

api-server-pod

[root@k8s manifests]# docker logs k8s_POD_kube-apiserver-k8s.master_kube-system_2f3af35c125801725e924d2739d691fd_6 -f<br/>Shutting down, got signal: Terminated<br/>Shutting down, got signal: Terminated

網路卡裝置缺失

截圖內的網路卡裝置在恢復前,都沒有正常啟動

image-20241106081520177

原因分析

從kubelet日誌可以看出,無法連線到api-server服務,

從api-server-pod 的日誌可以看出,是因為收到了一箇中斷訊號,所以服務啟動失敗

同時我是因為電腦卡機,被我強制關機,重新啟動的,所以推斷是因為強制關機導致pod無法正常重啟

解決:

使用kubekey把整個叢集刪除,再重新安裝叢集

使用KubeKey安裝K8s叢集

在K8s上安裝KubeSphere

相關文章