1

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.

Sam
  • 345
  • 3
  • 14

1 Answers1

1

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)
    }
}
Sam
  • 345
  • 3
  • 14