{
  "id": "kubernetes/horizontal-pod-autoscaler-unable-to-get-metrics",
  "signature": "Failed to get cpu utilization: unable to get metrics for resource cpu: unable to fetch metrics from resource metrics API: the server could not find the requested resource (get pods.metrics.k8s.io)",
  "signature_zh": "获取 CPU 利用率失败：无法获取资源 cpu 的指标：无法从资源指标 API 获取指标：服务器找不到请求的资源（get pods.metrics.k8s.io）",
  "regex": "unable to fetch metrics from resource metrics API: the server could not find the requested resource \\(get pods\\.metrics\\.k8s\\.io\\)",
  "domain": "kubernetes",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "Metrics Server is not deployed or not functioning, so the Horizontal Pod Autoscaler cannot retrieve CPU/memory metrics.",
  "root_cause_type": "generic",
  "root_cause_zh": "Metrics Server 未部署或未正常运行，导致 Horizontal Pod Autoscaler 无法获取 CPU/内存指标。",
  "versions": [
    {
      "version": "Metrics Server v0.6.4",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Kubernetes v1.28.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Kubernetes v1.29.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increasing HPA target thresholds or replica limits",
      "why_fails": "HPA still needs metrics to function; changing thresholds won't fix the missing metrics source.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Restarting the HPA controller manager",
      "why_fails": "The HPA controller is healthy; the issue is the metrics API backend, not the controller.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Deploy Metrics Server: `kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml`.",
      "success_rate": 0.9,
      "how": "Deploy Metrics Server: `kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If Metrics Server is installed but not working, check its logs: `kubectl logs -n kube-system deployment/metrics-server`. Common issues include TLS or node name resolution problems.",
      "success_rate": 0.8,
      "how": "If Metrics Server is installed but not working, check its logs: `kubectl logs -n kube-system deployment/metrics-server`. Common issues include TLS or node name resolution problems.",
      "condition": "",
      "sources": []
    },
    {
      "action": "For Minikube or kind clusters, enable metrics-server addon: `minikube addons enable metrics-server` or use kind's config to deploy it.",
      "success_rate": 0.85,
      "how": "For Minikube or kind clusters, enable metrics-server addon: `minikube addons enable metrics-server` or use kind's config to deploy it.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "部署 Metrics Server：`kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml`。",
    "如果 Metrics Server 已安装但无法工作，检查其日志：`kubectl logs -n kube-system deployment/metrics-server`。常见问题包括 TLS 或节点名称解析问题。",
    "对于 Minikube 或 kind 集群，启用 metrics-server 插件：`minikube addons enable metrics-server` 或使用 kind 的配置部署它。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://kubernetes.io/docs/tasks/debug/debug-cluster/resource-metrics-pipeline/",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2023-11-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}