- 通过 client-go 定时抓取集群内部 hpa 信息转换成 metric
Metric name | Metric type | Labels/tags | Status |
---|---|---|---|
hpa_status_last_scale_second | Gauge | hpa_name =<hpa-name> hpa_namespace =<hpa-namespace> ref_kind =<ref_kind> ref_name =<ref_name> ref_apiversion =<ref_apiversion> |
STABLE |
hpa_status_current_metrics_value | Gauge | hpa_name =<hpa-name> hpa_namespace =<hpa-namespace> ref_kind =<ref_kind> ref_name =<ref_name> ref_apiversion =<ref_apiversion> |
STABLE |
hpa_status_current_replicas | Gauge | hpa_name =<hpa-name> hpa_namespace =<hpa-namespace> ref_kind =<ref_kind> ref_name =<ref_name> ref_apiversion =<ref_apiversion> |
STABLE |
hpa_status_desired_replicas | Gauge | hpa_name =<hpa-name> hpa_namespace =<hpa-namespace> ref_kind =<ref_kind> ref_name =<ref_name> ref_apiversion =<ref_apiversion> |
STABLE |
hpa_status_able_to_scale | Gauge | hpa_name =<hpa-name> hpa_namespace =<hpa-namespace> ref_kind =<ref_kind> ref_name =<ref_name> ref_apiversion =<ref_apiversion> |
STABLE |
hpa_status_scaling_limited | Gauge | hpa_name =<hpa-name> hpa_namespace =<hpa-namespace> ref_kind =<ref_kind> ref_name =<ref_name> ref_apiversion =<ref_apiversion> |
STABLE |
hpa_spec_max_replicas | Gauge | hpa_name =<hpa-name> hpa_namespace =<hpa-namespace> ref_kind =<ref_kind> ref_name =<ref_name> ref_apiversion =<ref_apiversion> |
STABLE |
hpa_spec_min_replicas | Gauge | hpa_name =<hpa-name> hpa_namespace =<hpa-namespace> ref_kind =<ref_kind> ref_name =<ref_name> ref_apiversion =<ref_apiversion> |
STABLE |
hpa_spec_target_metrics_value | Gauge | hpa_name =<hpa-name> hpa_namespace =<hpa-namespace> ref_kind =<ref_kind> ref_name =<ref_name> ref_apiversion =<ref_apiversion> |
STABLE |
hpa_status_last_scale_second
hpa 上一次扩容时间hpa_status_current_metrics_value
hpa 当前值,可以通过这个指标获取一组服务的平均 cpu 使用率hpa_spec_target_metrics_value
hpa 阈值hpa_status_able_to_scale
hpa 是否能扩容hpa_status_scaling_limited
hpa 扩容是否受限
注: hpa 扩容受限条件 (CurrentCPUUtilizationPercentage>=TargetCPUUtilizationPercentage && a.Status.DesiredReplicas >= a.Spec.MaxReplicas)
- 程序启动参数还可以通过
--additional-label
flag 参数指定额外的 label
$ kubectl create ns monitoring # 如果有了 ns 可以跳过
$ kubectl apply -f deploy/deploy.yaml