我已经安装了kubeadm
,kubelet
并kubectl
使用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
这对我有用。