简体   繁体   English

获取除 kube-system 中的 pod 之外的所有 pod

[英]Get all pods except the pods inside kube-system

When I do当我做

kubectl get pods -A

I get all pods, and I always have 17 pods that are not "apps", they belong to namespace kube-system .我得到了所有的 pod,而且我总是有 17 个不是“应用程序”的 pod,它们属于命名空间kube-system I would like to have an alias not to print them.我想有一个别名不打印它们。

Is there a way to print all pods, excluding a namespace?有没有办法打印所有 pod,不包括命名空间?

You can accomplish this via field selectors :您可以通过字段选择器完成此操作:

kubectl get pods -A --field-selector=metadata.namespace!=kube-system

Additionally, the field selector list can have multiple parameters, separated by , (comma literals), and use == or != to specify additional criteria.此外,字段选择器列表可以有多个参数,由, (逗号文字)分隔,并使用==!=指定其他条件。

Use --field-selector使用--field-selector

kubectl get pods --all-namespaces --field-selector metadata.namespace!=kube-system

more about field selectors here: https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/更多关于字段选择器的信息: https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Kubernetes Logs - 如何获取kube-system pod的日志 - Kubernetes Logs - How to get logs for kube-system pods Rancher:kube-system pod 卡在 ContainerCreating 上 - Rancher: kube-system pods stuck on ContainerCreating kube-system 命名空间中的 pod 是如何管理的? - How are pods in kube-system namespace managed? 防止 kube-system pods 在特定节点上运行 - Prevent kube-system pods from running on a specific node docker-for-mac&kubernetes在命名空间kube-system中没有pods - docker-for-mac & kubernetes no pods in namespace kube-system kube系统/入口控制器盒的多个副本? - Multiple replicas of kube-system/ingress controller pods? Kubernetes-什么是kube系统吊舱,删除它们是否安全? - Kubernetes - What are kube-system pods and is it safe to delete them? kube-system(kube-controller 和 kube-flannels)pod 使用了太多资源 - kube-system (kube-controller and kube-flannels) pods are using too much resources K3S 多个 Kube-System pod 未以未知状态运行,包括 DNS 个 pod - K3S multiple Kube-System pods not running with Unknown Status, including DNS pods 为什么某些kube-system Pod(例如kube-proxy)与它们所在的节点具有相同的Pod IP? - Why do certain kube-system Pods such as kube-proxy have the same Pod IP as the node that they are on?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM