<p>I can list all the <code>custom.metrics</code> available, but I don't know how to query an individual value. For example I have tried:</p>

<pre><code>curl http://localhost:8001/apis/custom.metrics.k8s.io/v1beta1/ | jq .

{
  "kind": "APIResourceList",
  "apiVersion": "v1",
  "groupVersion": "custom.metrics.k8s.io/v1beta1",
  "resources": [
    {
      "name": "deployments.apps/aws_sqs_approximate_number_of_messages_visible_average",
      "singularName": "",
      "namespaced": false,
      "kind": "MetricValueList",
      "verbs": [
        "get"
      ]
    }
  ]
}
</code></pre>

<p>But if I try this:</p>

<pre><code>curl http://localhost:8001/apis/custom.metrics.k8s.io/v1beta1/deployments.apps/aws_sqs_approximate_number_of_messages_visible_average | jq .

{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {

  },
  "status": "Failure",
  "message": "the server could not find the requested resource",
  "reason": "NotFound",
  "details": {

  },
  "code": 404
}
</code></pre>

<p>I get a 404. I've seen <a href="https://github.com/DirectXMan12/k8s-prometheus-adapter/issues/164#issuecomment-465084278" rel="nofollow noreferrer">this issue</a> which shows how to get a namespaced metric, but mine does not have a namespace? Is there a definition for how to use this API?</p>

<p>Just like Resource Metrics, Custom Metrics are bound to Kubernetes objects too.
What you're missing in your URL is the resource you want the metric to relate to.
For example the Pod the custom metric is related to, but the same is true for Deployments.</p>

<p>Try to adjust this url to your needs:</p>

<pre><code>kubectl get --raw \
'/apis/custom.metrics.k8s.io/v1beta1/namespaces/default/pod/podinfo-67c9fd95d-fqk4g/http_requests_per_second' \
| jq .
</code></pre>

<p>Here are the slides for the talk we gave at FOSDEM 2019 on the Prometheus Adapter: <a href="https://speakerdeck.com/metalmatze/kubernetes-metrics-api?slide=26" rel="nofollow noreferrer">https://speakerdeck.com/metalmatze/kubernetes-metrics-api?slide=26</a></p>

<p>I'll update this answer, once the video is available too.</p>
