<p>I've recently learned about kubectl <code>--field-selector</code> flag, but ran into errors when trying to use it with various objects.</p>

<p>For example :</p>

<pre class="lang-sh prettyprint-override"><code>$ kubectl delete jobs.batch --field-selector status.succeeded==1
Error from server (BadRequest): Unable to find "batch/v1, Resource=jobs" that match label selector "", field selector "status.succeeded==1": field label "status.succeeded" not supported for batchv1.Job
</code></pre>

<p>According to <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/#supported-fields" rel="noreferrer">the documentation</a>, <code>Supported field selectors vary by Kubernetes resource type.</code>, so I guess this behaviour was to be expected.</p>

<p>The annoying part is that I had to try individually each field to know if I could use them or not.</p>

<p>Is there any way to get all the fields supported for a given resource type / resource version / kubectl version ?</p>

toadjaune
<p>The issue in your case is that you mistakenly use <code>status.succeeded</code> instead of <code>status.successful</code>, so right command is</p>
<pre><code>kubectl delete jobs.batch --field-selector status.successful==1
No resources found
</code></pre>
<p>Regarding your question about all the fields: my suggestion is to deep into the code and search for proper resources types in conversion.go for each API.</p>
<p>Example:
<a href="https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/batch/v1/conversion.go#L30-L41" rel="noreferrer">Batch Jobs conversion.go</a></p>
<pre><code>    return scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.WithKind(&quot;Job&quot;),
        func(label, value string) (string, string, error) {
            switch label {
            case &quot;metadata.name&quot;, &quot;metadata.namespace&quot;, &quot;status.successful&quot;:
                return label, value, nil
            default:
                return &quot;&quot;, &quot;&quot;, fmt.Errorf(&quot;field label %q not supported for batchv1.Job&quot;, label)
            }
        },
    )
}
</code></pre>
