Ubuntu 22.04LTS 与 Kubernetes 1.26.0 上的 kubectl 连接问题

Ubuntu 22.04LTS 与 Kubernetes 1.26.0 上的 kubectl 连接问题

我已经安装了kubeadmkubeletkubectl使用sudo apt install命令,它们都是版本1.26.0。我使用 Ubuntu 22.04LTS 机器。我只是想在本地计算机上测试和使用 Kubernetes。但我不知道为什么每当我尝试kubectl以下命令时都会收到以下错误消息kubelctl get pods/nodes/etc

kubectl get pods
E1212 08:13:11.758898    4321 memcache.go:238] couldn't get current server API group list: Get "https://192.168.1.2:6443/api?timeout=32s": dial tcp 192.168.1.2:6443: connect: connection refused
E1212 08:13:11.759479    4321 memcache.go:238] couldn't get current server API group list: Get "https://192.168.1.2:6443/api?timeout=32s": dial tcp 192.168.1.2:6443: connect: connection refused
E1212 08:13:11.761197    4321 memcache.go:238] couldn't get current server API group list: Get "https://192.168.1.2:6443/api?timeout=32s": dial tcp 192.168.1.2:6443: connect: connection refused
E1212 08:13:11.762636    4321 memcache.go:238] couldn't get current server API group list: Get "https://192.168.1.2:6443/api?timeout=32s": dial tcp 192.168.1.2:6443: connect: connection refused
E1212 08:13:11.764083    4321 memcache.go:238] couldn't get current server API group list: Get "https://192.168.1.2:6443/api?timeout=32s": dial tcp 192.168.1.2:6443: connect: connection refused
The connection to the server 192.168.1.2:6443 was refused - did you specify the right host or port?

我不知道为什么会收到此错误消息。

答案1

如果您的运行时是 docker 并且使用 minikube,那么您应该考虑运行:

minikube delete
open -a docker
minikube start --driver=docker
kubectl get pods

这对我有用。

相关内容