Kubectl get field-selector Support: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 18: | Line 18: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
The server only supports a limited number of field queries per each resource type. Supported fields vary per type. For example, attempting to query a PV for <code>spec.claimRef.name</code> fails with: | |||
<syntaxhighlight lang='text'> | |||
Error from server (BadRequest): Unable to find "/v1, Resource=persistentvolumes" that match label selector "", field selector "spec.claimRef.name=something": "spec.claimRef.name" is not a known field selector: only "metadata.name", "metadata.namespace" | |||
</syntaxhighlight> | |||
=Usage Examples= | =Usage Examples= |
Revision as of 18:09, 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 each resource type. Supported fields vary per type. For example, attempting to query a PV for spec.claimRef.name
fails with:
Error from server (BadRequest): Unable to find "/v1, Resource=persistentvolumes" that match label selector "", field selector "spec.claimRef.name=something": "spec.claimRef.name" is not a known field selector: only "metadata.name", "metadata.namespace"
Usage Examples
kubectl get pods --all-namespaces -o wide --field-selector spec.nodeName=<node>