Я пытаюсь настроить автоматическое масштабирование на openshift OKD. Я использую Openshift 3.11.
Итак, я установил метрики и метрики Hawkular, установил URL-адрес и установил файлы хоста, указывающие на него.
Получение HorizontalPodAutoscaler
:
oc describe hpa
Дает:
Name: blog
Namespace: demo
Labels: <none>
Annotations: <none>
CreationTimestamp: Mon, 28 Oct 2019 13:35:07 +0200
Reference: DeploymentConfig/blog
Metrics: ( current / target )
resource cpu on pods (as a percentage of request): <unknown> / 50%
Min replicas: 1
Max replicas: 10
DeploymentConfig pods: 3 current / 0 desired
Conditions:
Type Status Reason Message
---- ------ ------ -------
AbleToScale True SucceededGetScale the HPA controller was able to get the target's current scale
ScalingActive False FailedGetResourceMetric 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)
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedComputeMetricsReplicas 1h (x41 over 1h) horizontal-pod-autoscaler 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)
Warning FailedGetResourceMetric 4m (x171 over 1h) horizontal-pod-autoscaler 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)
Таким образом, он не может получить доступ к Metrics API.
Кроме того, получение метрик APIProxy дает:
oc adm diagnostics MetricsApiProxy
Дает:
[Note] Determining if client configuration exists for client/cluster diagnostics
Info: Successfully read a client config file at '/Users/example/.kube/config'
Info: Using context for cluster-admin access: 'demo/openshift-example-co-za:8443/exampleh'
[Note] Running diagnostic: MetricsApiProxy
Description: Check the integrated heapster metrics can be reached via the API proxy
ERROR: [DClu4003 from diagnostic MetricsApiProxy@openshift/origin/pkg/oc/cli/admin/diagnostics/diagnostics/cluster/metrics.go:89]
Unable to access the metrics API Proxy endpoint /api/v1/proxy/namespaces/openshift-infra/services/https:heapster:/api/v1/model/metrics:
(*errors.StatusError) the server could not find the requested resource
The Horizontal Pod Autoscaler is not able to retrieve metrics to drive scaling.
[Note] Summary of diagnostics execution (version v3.11.0+0cbc58b):
[Note] Errors seen: 1
https://docs.openshift.com/container-platform/3.11/dev_guide/pod_autoscaling.html#req-for-using-hpas
Чтобы использовать горизонтальные автомасштабируемые модули, вам необходимо установить сервер метрик OpenShift Container Platform:
$ ansible-playbook \ /usr/share/ansible/openshift-ansible/playbooks/metrics-server/config.yml \ -e openshift_metrics_server_install = true
Вы можете проверить правильность установки сервера, запустив:
$ oc adm верхний узел $ oc adm верхний модуль