[英]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.