繁体   English   中英

部署HPA(Horizo​​ntal Pod Autoscaler)的自定义指标(http请求)?

[英]Deploy HPA (Horizontal Pod Autoscaler) based custom metric (http request)?

我正在使用基于http请求的HPA算法部署我的应用程序。 我按照这个链接 在“基于自定义指标的Auto Scaling”部分中。 我用他们的应用程序成功构建了 但是当我使用我的应用程序部署时,我收到错误:

$ kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta1/namespaces/default/pods/*/http_requests" | jq .
Error from server (NotFound): the server could not find the metric http_requests for pods

在这部分中,他们说“podinfo app公开了一个名为http_requests_total的自定义指标”。 那么,我的应用程序如何公开这样的自定义指标呢? 非常感谢!

您可以在此处找到有关此部署的更多信息。
另一个示例如何构建自定义指标的应用程序,您可以在此处此处找到。
在这两种情况下都使用“ Golang Client API

在您的教程的示例中,端口9898上有工作应用程序
tcp 0 0 ::: 9898 ::: * LISTEN 1 / podinfo

如果您不确定您的应用程序是否正常运行,请验证:

    kubectl get deploy,pods
    -- verify if your new deployment is working properly 
    kubectl describe <your pod>
    -- in case of any issues with your application:
    kubectl logs <your pod>
    -- if the port and an endpoint are the same as in the example
    curl <your pod ip (endpoint)>:9898/metrics 
       you should notice http_requests_total metrics: htp_requests_total{status="200"} 1926 
    -- for generall issues
    kubectl get events

请与您的调查结果和结果分享。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM