kubernetes去客户端使用节点和集群的存储 [英] kubernetes go client used storage of nodes and cluster

查看:132
本文介绍了kubernetes去客户端使用节点和集群的存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Go的新手。我想使用Go代码获取kubernetes中节点和集群的存储统计信息。如何使用Go获得免费和使用的Kubernetes节点和集群的存储。

解决方案

这实际上是两个问题: p>


  1. 如何对kubernets主机执行http请求?

    有关更多详细信息,请参见[1]。您可以至少以3种方式访问​​apiserver:

    a。 kubectl get nodes (不去)

    b。 kubectl代理,然后由http客户端转到此网址

    c。在kubernetes群集中运行pod


  2. 获取节点统计信息需要做什么?

    a。运行 kubectl describe节点,它会显示资源信息。

    b。现在运行 kubectl describe node --v = 7 ,它会显示REST调用。

我也认为你应该根据 https://stackoverflow.com/help/how-to-ask ,所以它反映了你真正想问的问题。

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


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.

解决方案

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

这篇关于kubernetes去客户端使用节点和集群的存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆