<p>I want to filter the output of a <code>kubectl</code> command running in <code>--watch</code> mode to keep an eye on changes to a certain k8s annotation. I'm using the following command:</p>

<p><code>kubectl get pod my-pod --watch -o json | jq '.metadata.annotations["my-annotation"]'</code></p>

<p>Problem is - nothing is printed until I stop the command. I'd like the <code>jq</code> to process the input and print it as the changes to <code>my-pod</code> happen.</p>

<p>I tried using the <code>--unbuffered</code> flag but it doesn't fix it.</p>

grdl
<p>So i've tested your command and it works perfectly. You are however missing a quote at the end of your command.</p>

<pre><code>kubectl get pod nginx-5dfd5597bb-tp8h7 --watch -o json | jq '.metadata.name'
</code></pre>

<p>gives me </p>

<pre><code>"nginx-5dfd5597bb-tp8h7"
</code></pre>

<p>if you can this command to work but not your own; it is probably related to the brackets and quotes or missing object keys.</p>
