<p>I can run <code>kubectl get pod nginx -o=jsonpath={'.status'}</code> to get just the status in json for my pod.</p>

<p>How can I do the same filtering but have the result returned in yaml instead of json?</p>

<p>So I would like to get this kind of output by the command:</p>

<pre><code>status:
  conditions:
  - lastProbeTime: null
    lastTransitionTime: "2019-05-31T14:58:57Z"
    status: "True"
    type: Initialized
  - lastProbeTime: null
    lastTransitionTime: "2019-05-31T14:59:02Z"
    status: "True"
    type: Ready
  - lastProbeTime: null
    lastTransitionTime: "2019-05-31T14:58:57Z"
    status: "True"
    type: PodScheduled
  containerStatuses:
  - containerID: docker://5eb07d9c8c4de3b1ba454616ef7b258d9ce5548a46d4d5521a0ec5bc2d36b716
    image: nginx:1.15.12
    imageID: docker-pullable://nginx@sha256:1d0dfe527f801c596818da756e01fa0e7af4649b15edc3eb245e8da92c8381f8
    lastState: {}
    name: nginx
    ready: true
    restartCount: 0
    state:
      running:
        startedAt: "2019-05-31T14:59:01Z"
</code></pre>

<p>You cannot do that with kubectl, there is no such output option for it. </p>

<p>However, it should be easy to extract that lines with <code>awk</code>.</p>

<pre><code>kubectl get pods -o yaml | awk '/^status:/{flag=1}flag'
</code></pre>

<p>This starts the output at the line <code>status:</code>. In this case that is exactly what yo want.</p>
