您好,登錄后才能下訂單哦!
本篇內(nèi)容主要講解“怎么解決go中的notready問(wèn)題”,感興趣的朋友不妨來(lái)看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來(lái)帶大家學(xué)習(xí)“怎么解決go中的notready問(wèn)題”吧!
[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節(jié)點(diǎn)處于notready狀態(tài),查看pod的terminating時(shí)間點(diǎn),7h以前;查看messages日志,報(bào)錯(cuò)也是從7h以前開(kāi)始的。
并且該節(jié)點(diǎn)處于單通狀態(tài):master和其他節(jié)點(diǎn)可以ping通k8s-02機(jī)器,k8s-02不能ping通其他機(jī)器。
確實(shí)網(wǎng)絡(luò)有問(wèn)題,于是查看calico的pod狀態(tài) 是ok的,calico-kube-controller也故障轉(zhuǎn)移了。
describe如下:
進(jìn)行抓k8s-02的icmp包,master接收到了 但不給回復(fù):
tcpdump -i eth0 icmp and host 10.170.36.46
到這里網(wǎng)絡(luò)排查 沒(méi)有頭緒,開(kāi)始根據(jù)describe的內(nèi)容查看kubelet并百度:
百度都是防火墻、關(guān)閉swap等等操作,但是我這里都沒(méi)有……重啟節(jié)點(diǎn)、重啟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停止時(shí)間:
同時(shí)根據(jù)messages里面的日志開(kāi)始報(bào)錯(cuò)時(shí)間 和pod停止時(shí)間一致,所以排查當(dāng)時(shí)時(shí)間點(diǎn)做了什么操作 ,排查 恢復(fù)即可!
重啟大法:
重啟節(jié)點(diǎn)、重啟kubelet 無(wú)效!
找到時(shí)間點(diǎn)的歷史命令,做了externalIp操作,并且和k8s-02的ip一致,刪除externalIp 網(wǎng)絡(luò)恢復(fù),節(jié)點(diǎn)ready!
==將ipvs換成iptables就可以正常使用externalIp!==
到此,相信大家對(duì)“怎么解決go中的notready問(wèn)題”有了更深的了解,不妨來(lái)實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。