[root@his ~]# kubectl cluster-info E0715 20:57:07.120909 4869 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused E0715 20:57:07.121104 4869 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused E0715 20:57:07.122453 4869 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused E0715 20:57:07.123973 4869 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused E0715 20:57:07.125470 4869 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'. The connection to the server localhost:8080 was refused - did you specify the right host or port? 如何解决
根据你提供的错误信息,连接到 Kubernetes API 服务器时遇到了连接拒绝的问题。这可能是由于以下原因导致的:
Kubernetes API 服务器未正确启动或无法访问。请确保 Kubernetes API 服务器正在运行,并且在本地主机的端口8080上提供服务。
如果你正在使用不同的主机或端口,请检查
kubectl
命令中是否使用了正确的主机和端口。可以尝试使用-s
或--server
选项指定正确的主机和端口。例如:kubectl cluster-info --server=https://my-kubernetes-server:6443
如果你正在使用非默认的 kubeconfig 文件,请确保已正确配置
KUBECONFIG
环境变量或使用--kubeconfig
标志指定正确的 kubeconfig 文件路径。如果你是在本地运行 Kubernetes 集群,请确保你的本地环境正确设置并且可以访问 localhost:8080。可以尝试使用浏览器或 curl 命令访问该地址,以确认是否能够连接。
如果上述解决方法仍然无法解决问题,你可以尝试执行 kubectl cluster-info dump
命令,该命令会生成一个详细的集群信息报告,用于进一步排查和诊断问题。
error: failed to create token: Post "http://localhost:8080/api/v1/namespaces/kube-system/serviceaccounts/admin-user/token": dial tcp [::1]:8080: connect: connection refused [root@k8s-node-2 ~]# kubectl cluster-info E0605 09:11:48.387028 2716053 memcache.go:238] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused E0605 09:11:48.387335 2716053 memcache.go:238] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused E0605 09:11:48.388415 2716053 memcache.go:238] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused E0605 09:11:48.389705 2716053 memcache.go:238] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused E0605 09:11:48.390997 2716053 memcache.go:238] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'. The connection to the server localhost:8080 was refused - did you specify the right host or port?
根据错误信息,连接到Kubernetes API服务器时出现了拒绝连接的错误。这可能是由于以下原因之一导致的:
Kubernetes API服务器未运行:请确保Kubernetes API服务器正在运行。您可以通过运行以下命令来检查API服务器是否正在运行:
sudo systemctl status kube-apiserver
如果API服务器未运行,请尝试启动它:
sudo systemctl start kube-apiserver
API服务器地址或端口不正确:请确保您正在使用正确的API服务器地址和端口。默认情况下,kubectl将尝试连接到本地主机的8080端口。如果您的API服务器在不同的地址或端口上运行,请使用以下命令手动指定API服务器地址和端口:
kubectl cluster-info --server=<API-server-address>
请将
<API-server-address>
替换为实际的API服务器地址和端口。kubectl无法访问kubeconfig文件:请确保您的kubectl正在使用正确的
kubeconfig
文件。kubeconfig
文件包含与Kubernetes集群的连接信息。您可以使用以下命令检查当前使用的kubeconfig
:kubectl config view
如果需要,可以使用以下命令切换到其他
kubeconfig
文件:kubectl config use-context <context-name>
请将
<context-name>
替换为要使用的context
的名称。防火墙或网络问题:请确保可以从kubectl到达Kubernetes API服务器的网络路径没有被防火墙或其他网络设备阻塞。另外,请确保网络连接正常。
如果上述解决方法都无法解决问题,请提供更多上下文信息以便我更好地帮助您解决问题。
[root@ecs-master ~]# kubectl get priorityclasses.scheduling.k8s.io E0712 14:56:18.090944 3332 memcache.go:255] couldn't get resource list for metrics.k8s.io/v1beta1: the server is currently unable to handle the request E0712 14:56:18.104859 3332 memcache.go:106] couldn't get resource list for metrics.k8s.io/v1beta1: the server is currently unable to handle the request E0712 14:56:18.112841 3332 memcache.go:106] couldn't get resource list for metrics.k8s.io/v1beta1: the server is currently unable to handle the request E0712 14:56:18.116473 3332 memcache.go:106] couldn't get resource list for metrics.k8s.io/v1beta1: the server is currently unable to handle the request
这些错误日志表明在执行 kubectl get priorityclasses.scheduling.k8s.io
命令时,无法获取到 metrics.k8s.io/v1beta1 的资源列表。错误提示显示服务器当前无法处理该请求。这可能是由于以下原因之一造成的:
资源服务不可用:检查 Kubernetes 集群中的 metrics 服务是否正常运行。确保 metrics 服务已正确安装和配置,并且正在运行。
网络问题:检查网络连接是否正常。确保可以从当前主机访问 metrics 服务。尝试与 metrics 服务建立连接并验证是否可以正常获取资源列表。
版本不匹配:检查使用的 Kubernetes 版本和 metrics 服务版本是否兼容。如果版本不匹配,则可能会导致无法获取资源列表的错误。
请根据具体情况逐一排查这些可能原因,并尝试解决问题。
相关推荐








