我需要获取不是由控制器创建的所有 Pod 的列表,以便我可以在节点上进行排空之前决定如何处理它们。
否则我会收到消息:
error: cannot delete Pods not managed by ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet (use --force to override) while running the drain.
Run Code Online (Sandbox Code Playgroud)
我可以通过运行并查看 Controlled By: 是否丢失来找到信息kubectl describe <pod>,但我想以编程方式搜索节点上的所有 pod,因为它kubectl describe不是为此设计的。我需要找到替代方法。