您好,登錄后才能下訂單哦!
本篇內容主要講解“怎么解決go中的notready問題”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“怎么解決go中的notready問題”吧!
[root@k8s-01 ing]# kubectl version Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.0", GitCommit:"cb303e613a121a29364f75cc67d3d580833a7479", GitTreeState:"clean", BuildDate:"2021-04-08T16:25: 06Z", GoVersion:"go1.16.1", Compiler:"gc", Platform:"linux/amd64"}[root@k8s-01 ing]# kubectl version |grep server [root@k8s-01 ing]# kubectl get node NAME STATUS ROLES AGE VERSION k8s-01 Ready control-plane,master 18d v1.21.0 k8s-02 Ready worker 18d v1.21.0 k8s-03 Ready worker 18d v1.21.0
k8s-02節點處于notready狀態,查看pod的terminating時間點,7h以前;查看messages日志,報錯也是從7h以前開始的。
并且該節點處于單通狀態:master和其他節點可以ping通k8s-02機器,k8s-02不能ping通其他機器。
確實網絡有問題,于是查看calico的pod狀態 是ok的,calico-kube-controller也故障轉移了。
describe如下:
進行抓k8s-02的icmp包,master接收到了 但不給回復:
tcpdump -i eth0 icmp and host 10.170.36.46
到這里網絡排查 沒有頭緒,開始根據describe的內容查看kubelet并百度:
百度都是防火墻、關閉swap等等操作,但是我這里都沒有……重啟節點、重啟kubelet都不行!
查看日志messages:
May 11 21:27:58 k8s-02 kubelet: I0511 21:27:58.469919 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:27:59 k8s-02 kubelet: I0511 21:27:59.469278 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:28:00 k8s-02 kubelet: I0511 21:28:00.469261 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:28:00 k8s-02 kubelet: E0511 21:28:00.598812 651 event.go:273] Unable to write event: '&v1.Event{TypeMeta:v1.TypeMeta{Kind:"", APIVersion:""}, ObjectMeta:v1.Obje ctMeta{Name:"k8s-02.167e04da740613a2", GenerateName:"", Namespace:"default", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}}, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Finalizers:[]string(nil), ClusterName:"", ManagedFields:[]v1.ManagedFieldsEntry(nil)}, InvolvedObject:v1.ObjectReference{Kind:"Node", Namespace:"", Name:"k8s-02", UID:"k8s-02", APIVersion:"", ResourceVersion:"", FieldPath:""}, Reason:"NodeHasSufficientPID", Message:"Node k8s-02 status is now: NodeHasSufficientPID", Source:v1.EventSource{Component:"kubelet", Host:"k8s-02"}, FirstTimestamp:v1.Time{Time:time.Time{wall:0xc01ebe130bad1ba2, ext:12673521163, loc:(*time.Location)(0x74ad9e0)}}, LastTimestamp:v1.Time{Time:time.Time{wall:0xc01ebe130bad1ba2, ext:12673521163, loc:(*time.Location)(0x74ad9e0)}}, Count:1, Type:"Normal", EventTime:v1.MicroTime{Time:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}}, Series:(*v1.EventSeries)(nil), Action:"", Related:(*v1.ObjectReference)(nil), ReportingController:"", ReportingInstance:""}': 'Post "https://10.170.2.32:6443/api/v1/namespaces/default/events": dial tcp 10.170.2.32:6443: i/o timeout'(may retry after sleeping)May 11 21:28:01 k8s-02 kubelet: I0511 21:28:01.469790 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:28:02 k8s-02 kubelet: I0511 21:28:02.406629 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:28:02 k8s-02 kubelet: I0511 21:28:02.406669 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:28:02 k8s-02 kubelet: I0511 21:28:02.469338 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:28:03 k8s-02 kubelet: I0511 21:28:03.407443 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:28:03 k8s-02 kubelet: I0511 21:28:03.469928 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:28:03 k8s-02 kubelet: I0511 21:28:03.617223 651 trace.go:205] Trace[766683077]: "Reflector ListAndWatch" name:k8s.io/client-go/informers/factory.go:134 (11-May- 2021 21:27:33.615) (total time: 30001ms):May 11 21:28:03 k8s-02 kubelet: Trace[766683077]: [30.001402015s] [30.001402015s] END May 11 21:28:03 k8s-02 kubelet: E0511 21:28:03.617257 651 reflector.go:138] k8s.io/client-go/informers/factory.go:134: Failed to watch *v1.Service: failed to list *v1.Ser vice: Get "https://10.170.2.32:6443/api/v1/services?limit=500&resourceVersion=0": dial tcp 10.170.2.32:6443: i/o timeoutMay 11 21:28:04 k8s-02 kubelet: I0511 21:28:04.407120 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:28:04 k8s-02 kubelet: I0511 21:28:04.469376 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:28:05 k8s-02 kubelet: I0511 21:28:05.407095 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:28:05 k8s-02 kubelet: I0511 21:28:05.469475 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:28:05 k8s-02 kubelet: I0511 21:28:05.769847 651 trace.go:205] Trace[347094812]: "Reflector ListAndWatch" name:k8s.io/client-go/informers/factory.go:134 (11-May- 2021 21:27:35.768) (total time: 30000ms):May 11 21:28:05 k8s-02 kubelet: Trace[347094812]: [30.000987614s] [30.000987614s] END May 11 21:28:05 k8s-02 kubelet: E0511 21:28:05.769907 651 reflector.go:138] k8s.io/client-go/informers/factory.go:134: Failed to watch *v1.CSIDriver: failed to list *v1.C SIDriver: Get "https://10.170.2.32:6443/apis/storage.k8s.io/v1/csidrivers?limit=500&resourceVersion=0": dial tcp 10.170.2.32:6443: i/o timeoutMay 11 21:28:06 k8s-02 kubelet: I0511 21:28:06.407171 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:28:06 k8s-02 kubelet: I0511 21:28:06.469821 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:28:06 k8s-02 kubelet: I0511 21:28:06.469863 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:28:06 k8s-02 kubelet: E0511 21:28:06.469887 651 kubelet.go:2298] "Error getting node" err="nodes have not yet been read at least once, cannot construct node obj ect"May 11 21:28:06 k8s-02 kubelet: I0511 21:28:06.570550 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:28:06 k8s-02 kubelet: I0511 21:28:06.570599 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:28:07 k8s-02 kubelet: I0511 21:28:07.407416 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:28:07 k8s-02 kubelet: I0511 21:28:07.571241 651 kubelet.go:461] "Kubelet nodes not sync" May 11 21:28:08 k8s-02 kubelet: I0511 21:28:08.407052 651 kubelet.go:461] "Kubelet nodes not sync"
日志也百度了,總之就是連不上master……
查看pod停止時間:
同時根據messages里面的日志開始報錯時間 和pod停止時間一致,所以排查當時時間點做了什么操作 ,排查 恢復即可!
重啟大法:
重啟節點、重啟kubelet 無效!
找到時間點的歷史命令,做了externalIp操作,并且和k8s-02的ip一致,刪除externalIp 網絡恢復,節點ready!
==將ipvs換成iptables就可以正常使用externalIp!==
到此,相信大家對“怎么解決go中的notready問題”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。