簡介
本文檔介紹如何處理istiod pods生成的事件FailedGetResourceMetric
。
問題
在使用2023.01雲本地部署平台(CNDP)版本部署使用者微服務基礎設施(SMI)集群後,人們注意到istiod pod不斷生成FailedGetResourceMetric
事件:
cloud-user@ndce-smi-1:~$ kubectl get events -A -o yaml
apiVersion: v1
items:
- apiVersion: v1
count: 467057
eventTime: null
firstTimestamp: "2023-12-31T03:57:42Z"
involvedObject:
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
name: istiod
namespace: istio-system
resourceVersion: "4374"
uid: c85a05a1-b9ec-4241-8347-0b3c9eec1193
kind: Event
lastTimestamp: "2024-03-22T14:42:49Z"
message: '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)'
metadata:
creationTimestamp: "2023-12-31T03:57:42Z"
managedFields:
- apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:count: {}
f:firstTimestamp: {}
f:involvedObject:
f:apiVersion: {}
f:kind: {}
f:name: {}
f:namespace: {}
f:resourceVersion: {}
f:uid: {}
f:lastTimestamp: {}
f:message: {}
f:reason: {}
f:source:
f:component: {}
f:type: {}
manager: kube-controller-manager
operation: Update
time: "2023-12-31T03:57:42Z"
name: istiod.17a5ce7b410bceb6
namespace: istio-system
resourceVersion: "55452121"
selfLink: /api/v1/namespaces/istio-system/events/istiod.17a5ce7b410bceb6
uid: 9616bdc6-90d1-4475-b6af-6d41e185b434
reason: FailedGetResourceMetric
reportingComponent: ""
reportingInstance: ""
source:
component: horizontal-pod-autoscaler
type: Warning
kind: List
metadata:
resourceVersion: ""
selfLink: ""
分析
問題似乎是由於部署期間在istiod pod中啟用了Horizontal Pod Autoscaler (HPA)。由於HPA需要度量API來確定CPU使用率以向上或向下擴展Pod,並且度量API當前未在CNDP管理的Kubernetes群集中使用,因此這是istiod部署中的設計缺陷。
解決方案
從2023.03年CNDP發佈開始,HPA已被移除。