kubernetes go client used storage of nodes and cluster

10/16/2015

I am newbie in Go. I want to get the storage statistics of nodes and cluster in kubernetes using Go code. How i can get the free and used storage of Kubernetes nodes and cluster using Go.

--
go
kubernetes
nodes

1 Answer

10/16/2015

This is actually 2 problems:

  1. How do I perform http requests to the kubernets master?
    See [1] for more details. Tl;dr you can access the apiserver in at least 3 ways:
    a. kubectl get nodes (not go)
    b. kubectl proxy, followed by a go http client to this url
    c. Running a pod in a kubernetes cluster

  2. What are the requests I need to do to get node stats?
    a. Run kubectl describe node, it should show you resource information.
    b. Now run kubectl describe node --v=7, it should show you the REST calls.

I also think you should reformat the title of your question per https://stackoverflow.com/help/how-to-ask, so it reflects what you're really asking.

[1] https://github.com/kubernetes/kubernetes/blob/release-1.0/docs/user-guide/accessing-the-cluster.md

-- Prashanth B
Source: StackOverflow