简体   繁体   中英

Go lang / client : How to describe a node using go/ client

I want to use go client to describe a node, to be specific I want to list the node condition types and it's status and also events.

Edit: I was able to describe the node and get node condition but not events or cpu/memory.

I found below to get node conditions and status but not events.

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)
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM