腾讯云 Serverless 集群
k8s版本:1.24.4
执行命令报错
代码语言:powershell复制kubectl cluster-info
C:Usersadmin>kubectl cluster-info
E0506 14:23:47.864588 6328 memcache.go:287] couldn't get resource list for custom.metrics.k8s.io/v1beta1: the server is currently unable to handle the request
E0506 14:23:47.862904 6328 memcache.go:287] couldn't get resource list for monitor.tencent.io/v1alpha1: the server is currently unable to handle the request
E0506 14:23:47.922816 6328 memcache.go:121] couldn't get resource list for monitor.tencent.io/v1alpha1: the server is currently unable to handle the request
E0506 14:23:47.962146 6328 memcache.go:121] couldn't get resource list for custom.metrics.k8s.io/v1beta1: the server is currently unable to handle the request
E0506 14:23:48.005653 6328 memcache.go:121] couldn't get resource list for monitor.tencent.io/v1alpha1: the server is currently unable to handle the request
E0506 14:23:48.050528 6328 memcache.go:121] couldn't get resource list for custom.metrics.k8s.io/v1beta1: the server is currently unable to handle the request
E0506 14:23:48.100011 6328 memcache.go:121] couldn't get resource list for monitor.tencent.io/v1alpha1: the server is currently unable to handle the request
E0506 14:23:48.149735 6328 memcache.go:121] couldn't get resource list for custom.metrics.k8s.io/v1beta1: the server is currently unable to handle the request
分析原因
代码语言:powershell复制kubectl describe apiservice v1alpha1.monitor.tencent.io
C:Usersadmin>kubectl describe apiservice v1alpha1.monitor.tencent.io
E0506 14:42:22.161058 11188 memcache.go:287] couldn't get resource list for monitor.tencent.io/v1alpha1: the server is currently unable to handle the request
E0506 14:42:22.189335 11188 memcache.go:287] couldn't get resource list for custom.metrics.k8s.io/v1beta1: the server is currently unable to handle the request
E0506 14:42:22.251846 11188 memcache.go:121] couldn't get resource list for monitor.tencent.io/v1alpha1: the server is currently unable to handle the request
E0506 14:42:22.290652 11188 memcache.go:121] couldn't get resource list for custom.metrics.k8s.io/v1beta1: the server is currently unable to handle the request
E0506 14:42:22.334942 11188 memcache.go:121] couldn't get resource list for monitor.tencent.io/v1alpha1: the server is currently unable to handle the request
E0506 14:42:22.374231 11188 memcache.go:121] couldn't get resource list for custom.metrics.k8s.io/v1beta1: the server is currently unable to handle the request
E0506 14:42:22.418244 11188 memcache.go:121] couldn't get resource list for monitor.tencent.io/v1alpha1: the server is currently unable to handle the request
E0506 14:42:22.456728 11188 memcache.go:121] couldn't get resource list for custom.metrics.k8s.io/v1beta1: the server is currently unable to handle the request
Name: v1alpha1.monitor.tencent.io
Namespace:
Labels: <none>
Annotations: <none>
API Version: apiregistration.k8s.io/v1
Kind: APIService
Metadata:
Creation Timestamp: 2024-04-29T09:28:13Z
Resource Version: 58225393992
UID: 879f173f-753a-46b5-8609-60ae197f04ea
Spec:
Group: monitor.tencent.io
Group Priority Minimum: 1000
Insecure Skip TLS Verify: true
Service:
Name: hpa-metrics-service
Namespace: kube-system
Port: 443
Version: v1alpha1
Version Priority: 15
Status:
Conditions:
Last Transition Time: 2024-04-30T07:05:43Z
Message: service/hpa-metrics-service in "kube-system" is not present
Reason: ServiceNotFound
Status: False
Type: Available
Events: <none>
可以从 Message 看到是说 hpa-metrics-service 这个service不存在,由此得知是因为现在v1alpha1.monitor.tencent.io
这个apiservice存在,但其关联的service(kube-system/hpa-metrics-service)不存在,导致这个apiservice没法正常工作。
解决办法,删掉 v1alpha1.monitor.tencent.io 这个apiservice
代码语言:powershell复制C:Usersadmin>kubectl delete apiservice v1beta1.custom.metrics.k8s.io
E0506 14:48:22.101551 12816 memcache.go:287] couldn't get resource list for custom.metrics.k8s.io/v1beta1: the server is currently unable to handle the request
E0506 14:48:22.205086 12816 memcache.go:287] couldn't get resource list for monitor.tencent.io/v1alpha1: the server is currently unable to handle the request
E0506 14:48:22.266699 12816 memcache.go:121] couldn't get resource list for monitor.tencent.io/v1alpha1: the server is currently unable to handle the request
E0506 14:48:22.310648 12816 memcache.go:121] couldn't get resource list for custom.metrics.k8s.io/v1beta1: the server is currently unable to handle the request
E0506 14:48:22.361500 12816 memcache.go:121] couldn't get resource list for monitor.tencent.io/v1alpha1: the server is currently unable to handle the request
E0506 14:48:22.403837 12816 memcache.go:121] couldn't get resource list for custom.metrics.k8s.io/v1beta1: the server is currently unable to handle the request
E0506 14:48:22.448952 12816 memcache.go:121] couldn't get resource list for monitor.tencent.io/v1alpha1: the server is currently unable to handle the request
E0506 14:48:22.489589 12816 memcache.go:121] couldn't get resource list for custom.metrics.k8s.io/v1beta1: the server is currently unable to handle the request
apiservice.apiregistration.k8s.io "v1beta1.custom.metrics.k8s.io" deleted
同理,monitor.tencent.io/v1alpha1 这个apiservice 也是一样的处理
我们执行 kubectl 命令可以再看报错没有了
代码语言:txt复制C:Usersadmin>kubectl get pods
NAME READY STATUS RESTARTS AGE
kubernetes-proxy-6dfd6bc689-9qvtd 1/1 Running 0 153m
kubernetes-proxy-6dfd6bc689-l7gml 1/1 Running 0 153m