List supported field selectors by kind

Signed-off-by: Mario Valderrama <woldy401@gmail.com>
This commit is contained in:
Mario Valderrama 2023-11-07 09:54:21 +01:00
parent fb0089e02e
commit d912860063
No known key found for this signature in database
GPG Key ID: 58C083D3DBC09BEB
1 changed files with 13 additions and 1 deletions

View File

@ -32,6 +32,18 @@ kubectl get ingress --field-selector foo.bar=baz
Error from server (BadRequest): Unable to find "ingresses" that match label selector "", field selector "foo.bar=baz": "foo.bar" is not a known field selector: only "metadata.name", "metadata.namespace"
```
### List of supported fields
| Kind | Fields |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Pod | `spec.nodeName`<br>`spec.restartPolicy`<br>`spec.schedulerName`<br>`spec.serviceAccountName`<br>`spec.hostNetwork`<br>`status.phase`<br>`status.podIP`<br>`status.nominatedNodeName` |
| Event | `involvedObject.kind`<br>`involvedObject.namespace`<br>`involvedObject.name`<br>`involvedObject.uid`<br>`involvedObject.apiVersion`<br>`involvedObject.resourceVersion`<br>`involvedObject.fieldPath`<br>`reason`<br>`reportingComponent`<br>`source`<br>`type` |
| Secret | `type` |
| Namespace | `status.phase` |
| ReplicaSet | `status.replicas` |
| Job | `status.successful` |
| Node | `spec.unschedulable` |
## Supported operators
You can use the `=`, `==`, and `!=` operators with field selectors (`=` and `==` mean the same thing). This `kubectl` command, for example, selects all Kubernetes Services that aren't in the `default` namespace:
@ -58,4 +70,4 @@ You can use field selectors across multiple resource types. This `kubectl` comma
```shell
kubectl get statefulsets,services --all-namespaces --field-selector metadata.namespace!=default
```
```