Kubernetes (K8S) 错误 - 无法获取当前服务器 API 组列表:获取“https://poc_master_node:6443/api?timeout=32s”:服务不可用

问题描述 投票:0回答:1

目前在 Ubuntu 中面临一些

Kubernetes clusters (1 master node, 1 worker node setup)
的问题。列出了早期的节点,不幸的是现在针对集群的 kubectl 命令都不起作用。

执行命令

kubectl get pods
时,我遇到以下错误消息:

E1016 10:49:01.129636    4029 memcache.go:265] couldn't get current server API group list: Get "https://poc_master_node:6443/api?timeout=32s": Service Unavailable
E1016 10:49:01.139686    4029 memcache.go:265] couldn't get current server API group list: Get "https://poc_master_node:6443/api?timeout=32s": Service Unavailable
Unable to connect to the server: Service Unavailable

执行

kubectl version
命令时出错:

Client Version: v1.30.5
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Unable to connect to the server: Service Unavailable

进一步排除故障 - 执行

kubectl get nodes -v=10
命令时出现错误:

I1016 10:49:31.010826    4037 loader.go:395] Config loaded from file:  /etc/kubernetes/admin.conf
I1016 10:49:31.011732    4037 round_trippers.go:466] curl -v -XGET  -H "Accept: application/json;g=apidiscovery.k8s.io;v=v2;as=APIGroupDiscoveryList,application/json;g=apidiscovery.k8s.io;v=v2beta1;as=APIGroupDiscoveryList,application/json" -H "User-Agent: kubectl/v1.30.5 (linux/amd64) kubernetes/74e84a9" 'https://poc_master_node:6443/api?timeout=32s'
I1016 10:49:31.013627    4037 round_trippers.go:510] HTTP Trace: Dial to tcp:10.57.183.219:3128 succeed
I1016 10:49:31.015587    4037 round_trippers.go:553] GET https://poc_master_node:6443/api?timeout=32s  in 3 milliseconds
I1016 10:49:31.015826    4037 round_trippers.go:570] HTTP Statistics: DNSLookup 0 ms Dial 1 ms TLSHandshake 0 ms Duration 3 ms
I1016 10:49:31.016029    4037 round_trippers.go:577] Response Headers:
E1016 10:49:31.016268    4037 memcache.go:265] couldn't get current server API group list: Get "https://poc_master_node:6443/api?timeout=32s": Service Unavailable
I1016 10:49:31.016475    4037 cached_discovery.go:120] skipped caching discovery info due to Get "https://poc_master_node:6443/api?timeout=32s": Service Unavailable
I1016 10:49:31.016748    4037 round_trippers.go:466] curl -v -XGET  -H "Accept: application/json;g=apidiscovery.k8s.io;v=v2;as=APIGroupDiscoveryList,application/json;g=apidiscovery.k8s.io;v=v2beta1;as=APIGroupDiscoveryList,application/json" -H "User-Agent: kubectl/v1.30.5 (linux/amd64) kubernetes/74e84a9" 'https://poc_master_node:6443/api?timeout=32s'
I1016 10:49:31.018193    4037 round_trippers.go:510] HTTP Trace: Dial to tcp:10.57.183.219:3128 succeed
I1016 10:49:31.019721    4037 round_trippers.go:553] GET https://poc_master_node:6443/api?timeout=32s  in 2 milliseconds
I1016 10:49:31.020607    4037 round_trippers.go:570] HTTP Statistics: DNSLookup 0 ms Dial 1 ms TLSHandshake 0 ms Duration 2 ms
I1016 10:49:31.020882    4037 round_trippers.go:577] Response Headers:
E1016 10:49:31.021213    4037 memcache.go:265] couldn't get current server API group list: Get "https://poc_master_node:6443/api?timeout=32s": Service Unavailable
I1016 10:49:31.021363    4037 cached_discovery.go:120] skipped caching discovery info due to Get "https://poc_master_node:6443/api?timeout=32s": Service Unavailable
I1016 10:49:31.021384    4037 shortcut.go:103] Error loading discovery information: Get "https://poc_master_node:6443/api?timeout=32s": Service Unavailable

已经

KUBECONFIG
环境变量导出完成(主节点和工作节点):

echo $KUBECONFIG
/etc/kubernetes/admin.conf

kubectl config view
命令的结果:

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://poc_master_node:6443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: kubernetes-adm
  name: kubernetes-adm@kubernetes
current-context: kubernetes-adm@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-adm
  user:
    client-certificate-data: DATA+OMITTED
    client-key-data: DATA+OMITTED

详情如下:

Kub版本:Kubernetes 1.30 - K8S 操作系统:Ubuntu 22.04.5 LTS

按照这个博客步骤设置K8S集群

也已经检查了这个问题。

任何人都可以提供解决此问题的指导吗?

kubernetes kubectl
1个回答
0
投票

请问你现在有解决办法了吗

© www.soinside.com 2019 - 2024. All rights reserved.