I am trying to get all pods in a given node. Can list all nodes by following but node struct having NodeSpec and NodeStatus does not have container information.
nodes, _ := clientset.CoreV1().Nodes().List(metav1.ListOptions{})
Use a field selector
nodeName := "my-node"
pods, err := clientset.CoreV1().Pods("").List(metav1.ListOptions{
FieldSelector: "spec.nodeName=" + nodeName,
})
/close
Tks
Most helpful comment
Use a field selector
/close