503 kubernetes runtime_error ai_generated true

来自服务器的错误(服务不可用):服务器当前无法处理请求(获取 apiservices.apiregistration.k8s.io v1.metrics.k8s.io)

Error from server (ServiceUnavailable): the server is currently unable to handle the request (get apiservices.apiregistration.k8s.io v1.metrics.k8s.io)

ID: kubernetes/apiservice-not-available

其他格式: JSON · Markdown 中文 · English
78%修复率
82%置信度
1证据数
2024-01-10首次发现

版本兼容性

版本状态引入弃用备注
Kubernetes 1.26 active
Kubernetes 1.28 active
metrics-server 0.6.3 active

根因分析

指标(或其他扩展)的 API 服务未响应,通常是因为相应的控制器(如 metrics-server)已关闭、配置错误或服务端点不可达。

English

The API service for metrics (or another extension) is not responding, often because the corresponding controller (e.g., metrics-server) is down, misconfigured, or the service endpoint is unreachable.

generic

官方文档

https://kubernetes.io/docs/tasks/debug/debug-cluster/resource-metrics-pipeline/#metrics-server

解决方案

  1. Check the status of the extension API server pod, e.g., for metrics-server: `kubectl get pods -n kube-system | grep metrics-server`. If down, check logs: `kubectl logs -n kube-system <metrics-server-pod>`.
  2. Verify the service endpoint for the API service: `kubectl get endpoints -n kube-system <service-name>`. If no endpoints, the pod may not be listening on the correct port.
  3. Delete and recreate the APIService resource to force re-registration: `kubectl delete apiservice v1.metrics.k8s.io && kubectl apply -f metrics-server-apiservice.yaml`.

无效尝试

常见但无效的做法:

  1. 80% 失败

    Restarting the kube-apiserver pod does not fix the issue because the problem is with the extension API server, not the core API server.

  2. 60% 失败

    Reapplying the APIService YAML without checking the underlying service status may lead to the same error if the service is still down.