[踩雷] Kube Config 突然消失

 
 
有一天突然在檢查自動化實驗的結果時,我就沒權限對 K8s API Server 發 request 了
也就是不能用 kubectl 做任何操作,如下示意:
cfliao@cfliao1:~$ kubectl get nodes E0426 04:18:16.679982 2652958 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials E0426 04:18:16.680643 2652958 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials E0426 04:18:16.682269 2652958 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials E0426 04:18:16.683918 2652958 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials E0426 04:18:16.685476 2652958 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials error: You must be logged in to the server (the server has asked for the client to provide credentials)
東找西找都找不問題,最後才發現原來是 ~/.kube/config 的設定不見了⋯⋯
我也不知道要怎麼找回來,但就先想辦法把它復原
所以照著網路上 issue 的方式就成功啦