<p>I want to access metrics from kubernetes with golang. Something like cpu and memory per node as well as the same for pods and/or namespaces.</p>

<p>I am kind of lost here because the documentation is not as clear as it could be.</p>

<p>I have learned that there is <code>heapster</code> (which is deprecated according to the github repo). There is also <code>metric server</code> and a rest api.</p>

<p>Where can I find some examples to get started? I do not want to install another app, package or service in kubernetes. I'd like to get the information as native as possible. 
What is the preferred way to access these information with client-go and golang?</p>

<p>There's a much better API for this: <a href="https://github.com/kubernetes/metrics" rel="noreferrer">https://github.com/kubernetes/metrics</a>. Using this, you don't have to create the data structs or handle row byte slices.</p>

<pre><code>import (
  metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  metricsv "k8s.io/metrics/pkg/client/clientset/versioned"
  ...
)

...
clientset, err := metricsv.NewForConfig(config)
podMetricsList, err := clientset.MetricsV1beta1().PodMetricses("").List(metav1.ListOptions{})
</code></pre>
