[英]Go lang / client : How to describe a node using go/ client
我想使用 go 客戶端來描述一個節點,具體來說我想列出節點條件類型及其狀態和事件。
編輯:我能夠描述節點並獲取節點狀況,但不能描述事件或 cpu/內存。
我在下面找到了獲取節點條件和狀態但不是事件。
nodes, _ := clientset.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})
for _, node := range nodes.Items {
fmt.Printf("%s\n", node.Name)
for _, condition := range node.Status.Conditions {
fmt.Printf("\t%s: %s\n", condition.Type, condition.Status)
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.