Kubectl get field-selector Support: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 1: | Line 1: | ||
=External= | |||
* https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get | |||
=Internal= | =Internal= | ||
* [[Kubectl#--fieldSelector|kubectl]] | * [[Kubectl#--fieldSelector|kubectl]] | ||
Line 5: | Line 8: | ||
=Overview= | =Overview= | ||
<syntaxhighlight lang='bash'> | |||
kubectl get ... --field-selector <expression> | |||
</syntaxhighlight> | |||
field-selector | <code>--field-selector</code> specifies a selector (field query) to filter the result on. It supports the expressions containing '=', '==', and '!=', which can be applied to multiple fields. | ||
<syntaxhighlight lang='bash'> | |||
--field-selector key1=value1,key2=value2,key3!=value3 | |||
</syntaxhighlight> | |||
<font color=darkgray>The server only supports a limited number of field queries per type.</font> | |||
=Usage Examples= | |||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
kubectl get pods --all-namespaces -o wide --field-selector spec.nodeName=<node> | kubectl get pods --all-namespaces -o wide --field-selector spec.nodeName=<node> | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 18:02, 17 May 2021
External
Internal
Overview
kubectl get ... --field-selector <expression>
--field-selector
specifies a selector (field query) to filter the result on. It supports the expressions containing '=', '==', and '!=', which can be applied to multiple fields.
--field-selector key1=value1,key2=value2,key3!=value3
The server only supports a limited number of field queries per type.
Usage Examples
kubectl get pods --all-namespaces -o wide --field-selector spec.nodeName=<node>