<p>I am trying to get the CPU usage from the <code>/apis/events.k8s.io/v1beta1</code> endpoint in the kubernetes internal api.  </p>

<p>I run the following command</p>

<p><code>kubectl proxy --port=8080</code></p>

<p>Then load the url <a href="http://localhost:8080/apis/metrics.k8s.io/v1beta1/pods" rel="nofollow noreferrer">http://localhost:8080/apis/metrics.k8s.io/v1beta1/pods</a> and get a response similar to this one</p>

<pre><code>{
  "kind": "PodMetricsList",
  "apiVersion": "metrics.k8s.io/v1beta1",
  "metadata": {
    "selfLink": "/apis/metrics.k8s.io/v1beta1/pods"
  },
  "items": [
    {
      "metadata": {
        "name": "name-of-the-container-667656d796-p586s",
        "namespace": "namespace-name",
        "selfLink": "/apis/metrics.k8s.io/v1beta1/pods/name-of-the-container-667656d796-p586s",
        "creationTimestamp": "2019-11-20T21:34:02Z"
      },
      "timestamp": "2019-11-20T21:33:02Z",
      "window": "30s",
      "containers": [
        {
          "name": "name-of-the-container",
          "usage": {
            "cpu": "350748682n",
            "memory": "238860Ki"
          }
        }
      ]
    }
  ]
}
</code></pre>

<p>The cpu value is <code>350748682n</code>.  From <a href="https://discuss.kubernetes.io/t/metric-server-cpu-and-memory-units/7497" rel="nofollow noreferrer">this discussion</a> <code>n</code> is "1/1000000000 (1 billionth) of a cpu"</p>

<p>I am also seeing values like <code>14513u</code></p>

<p>I have reviewed the <a href="https://kubernetes.io/docs/reference/glossary/?all=true#term-quantity" rel="nofollow noreferrer">quantity</a> definition but do not see anything referencing <code>u</code></p>

<p>What are all the possible units used to report this metric? </p>

leemicw
<p><code>u</code> is a simplification of the lowercase Greek mu (μ) which means 10^-6, aka "micro-cpus". The unit is always the same, it's in terms of CPU cores. Metrics-server tries to report in nano-cpus for maximum accuracy, but if the number won't fit in an int64, it will change the scaling factor until it fits.</p>
