[持续更新] k8s 遇到的问题

发布时间 2023-11-03 21:29:08作者: zuozhengjun

kubectl 命令报错couldn't get current server API group list: ... connect: connection refused

kubenets在运行时,依赖环境变量。如果所有的服务都是正常的,只是kubectl命令报错,那就是环境变量没有设置导致。一般报错样例如下:

couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused。The connection to the server localhost:8080 was refused - did you specify the right host or port?

解决方案

重新进入客户端,或者重新写 ~/.kube/config