<p>I'd like to do a <code>kubectl get pods</code> and filter where the pod  is in a status of <code>ImagePullBackOff</code>.</p>

<p>I've tried <code>kubectl get pods --field-selector=status.phase=waiting</code> and <code>kubectl get pods --field-selector=status.phase=ImagePullBackOff</code> but that returns no results.</p>

<p>I've had a look at the JSON output with <code>-o json</code>:</p>

<pre><code>...
            {
                "image": "zzzzzzzzzzzzzzzz",
                "imageID": "",
                "lastState": {},
                "name": "nginx",
                "ready": false,
                "restartCount": 0,
                "state": {
                    "waiting": {
                        "message": "Back-off pulling image \"zzzzzzzzzzzzzzzz\"",
                        "reason": "ImagePullBackOff"
                    }
                }
            }
...
</code></pre>

<p>If I try target that value:</p>

<pre><code>kubectl get pods --field-selector=state.waiting=ImagePullBackOff 
Error from server (BadRequest): Unable to find "/v1, Resource=pods" that match label selector "", field selector "state.waiting=ImagePullBackOff": field label not supported: state.waiting
</code></pre>

Chris Stryczynski
<p>Using <code>json</code> output and piping through <code>jq</code>:</p>

<pre><code>kubectl get pod -o=json | jq '.items[]|select(any( .status.containerStatuses[]; .state.waiting.reason=="ImagePullBackOff"))|.metadata.name'
</code></pre>

<p>Last chunk <code>|.metadata.name</code> means it'll list pod names instead of the entire structures. </p>
