I have setup an external metrics server in AKS (Azure Kubernetes Service). I could see the metric when querying the external metric api server.
kubectl get --raw "/apis/external.metrics.k8s.io/v1beta1/namespaces/default/queuemessages" | jq .
{
"kind": "ExternalMetricValueList",
"apiVersion": "external.metrics.k8s.io/v1beta1",
"metadata": {
"selfLink": "/apis/external.metrics.k8s.io/v1beta1/namespaces/default/queuemessages"
},
"items": [
{
"metricName": "queuemessages",
"metricLabels": null,
"timestamp": "2020-04-09T14:04:08Z",
"value": "0"
}
]
}
I want to know how to delete this metric from the external metrics server?
It looks like you are interested in the Queue Bus metrics.
I found this issue that is still open talking about a big delay in the queue messages
metric to get populated.
https://github.com/Azure/azure-k8s-metrics-adapter/issues/63
the way custom-metric adapters work, they will query metrics from external services and make them available over a custom api on the Kubernetes API-server using a APiService resource.
https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-metrics-apis
The adapter implements a query to the external service (Service Bus in your case) base on the spec, the get metric should never fail, so receiving a NULL could be because you don't have a valid connection OR there isn't available m metrics yet.
First, there's a method for listing all metrics available at any point in time. It's used to populate the discovery information in the API, so that clients can know what metrics are available. It's not allowed to fail (it doesn't return any error), and it should return quickly, so it's suggested that you update it asynchronously in real-world code.
Could you explain why you are looking to delete the metrics ? In the end, I don't think it is possible since the adapter is there to fetch and report.