我想使用HPA扩展应用程序
基于对指标的支持
HPA能够从
metrics.k8s.io(资源指标)
custom.metrics.k8s.io(自定义指标)
external.metrics.k8s.io(外部指标)
我如何检查可用的指标?我怎么能自己尝试这个API?有可能吗?
附言
根据建议的答案,我执行了命令:
kubectl get --raw https://MY-KUBE-APISERVER-IP:6443/apis/metrics.k8s.io/v1beta1/namespaces/default/pods
回应是:
{
"items": [
{
"metadata": {
"name": "prometheus-adapter-69fcdd56bc-2plh7",
"namespace": "default",
"selfLink": "/\r\napis/metrics.k8s.io/v1beta1/namespaces/default/pods/prometheus-adapter-69fcdd56bc-2plh7",
"creationTimestamp": "2020-02-05T10:56:02Z"
},
"timestamp": "2020-02-05T10:55:22Z",
"window": "30s",
"containers": [
{
"name": "prometheus-adapter",
"usage": {
"cpu": "15\r\n31939n",
"memory": "10408Ki"
}
}
]
},
{
"metadata": {
"name": "stackdriver-exporter-76fdbc9d8f-c285l",
"namespace": "default",
"selfLink": "/apis/metrics.k8s.io/v1beta1/namespaces/default/pods/stackdriver-exporter-76fdbc9d8f-c285l",
"creationTimestamp": "2020-0\r\n2-05T10:56:02Z"
},
"timestamp": "2020-02-05T10:55:22Z",
"window": "30s",
"containers": [
{
"name": "stackdriver-exporter",
"usage": {
"cpu": "79340n",
"memory": "2000Ki"
}
}
]
}
],
"kind": "PodMetricsList",
"apiVersion": "metrics.k8s.io/v1beta1",
"metadata": {
"selfLink": "/apis/metrics.k8s.io/v1beta1/namespaces/default/pods"
}
}
$ kubectl top pods
NAME CPU(cores) MEMORY(bytes)
prometheus-adapter-69fcdd56bc-2plh7 2m 10Mi
stackdriver-exporter-76fdbc9d8f-c285l 1m 1Mi
但我仍然没有看到所有可用于 HPA 的指标