Я не могу заставить работать автоматическое масштабирование с настройкой targetcpuutilization. Моя конфигурация следующая:
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: pod
namespace: pod
spec:
minReplicas: 1
maxReplicas: 5
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: pod
metrics:
- type: Resource
resource:
name: cpu
targetAverageUtilization: 10
message: 'the HPA was unable to compute the replica count: 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)'
reason: FailedGetResourceMetric
Я убедился, что сервер метрик работает. Когда я проверяю hpa, я получаю следующее:
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
pod-name Deployment/pod-name <unknown>/10% 1 5 1 15h
Журнал событий для пространства имен показывает это:
LAST SEEN FIRST SEEN COUNT NAME KIND SUBOBJECT TYPE REASON SOURCE MESSAGE
46m 15h 1721 pod-name.155162c884d417be HorizontalPodAutoscaler Warning FailedComputeMetricsReplicas horizontal-pod-autoscaler failed to get cpu utilization: unable to get metrics for resource cpu: no metrics returned from resource metrics API
1m 15h 1811 pod-name.155162c884a5caa2 HorizontalPodAutoscaler Warning FailedGetResourceMetric horizontal-pod-autoscaler unable to get metrics for resource cpu: no metrics returned from resource metrics API
Похоже, что модули не могут попасть на сервер метрик.
Вход на сервер метрик:
unable to fully collect metrics: [unable to fully scrape metrics from source kubelet_summary:host.com: unable to fetch metrics from Kubelet host.com (host.com): Get https://host.com:10250/stats/summary/: x509: certificate signed by unknown authority, unable to fully scrape metrics from source
kubelet_summary:host.ibaset.com: unable to fetch metrics from Kubelet host.ibaset.com (host.ibaset.com): Get https://host.com:10250/stats/summary/: x509: certificate signed by unknown authority, unable to fully scrape metrics from source kubelet_summary:host.com: unable to fetch metrics from Kubelet host.com (host.com): Get https://host.com:10250/stats/summary/: x509: certificate signed by unknown authority]