<p>Is there a way to easily query Kubernetes resources in an intuitive way? Basically I want to run queries to extract info about objects which match my criteria. Currently I face an issue where my match labels isn't quite working and I would like to run the match labels query manually to try and debug my issue. </p>

<p>Basically in a pseudo code way:</p>

<p>Select * from pv where labels in [red,blue,green]</p>

<p>Any third party tools who do something like this? Currently all I have to work with is the search box on the dashboard which isn't quite robust enough. </p>

<p>You could use <code>kubectl</code> with JSONPath (<a href="https://kubernetes.io/docs/reference/kubectl/jsonpath/" rel="nofollow noreferrer">https://kubernetes.io/docs/reference/kubectl/jsonpath/</a>). More information on JSONPath: <a href="https://github.com/json-path/JsonPath" rel="nofollow noreferrer">https://github.com/json-path/JsonPath</a></p>

<p>It allows you to query any resource property, example:</p>

<pre><code>kubectl get pods -o=jsonpath='{$.items[?(@.metadata.namespace=="default")].metadata.name}'
</code></pre>

<p>This would list all pod names in namespace "default". Your pseudo code would be something along the lines:</p>

<pre><code>kubectl get pv -o=jsonpath='{$.items[?(@.metadata.label in ["red","blue","green"])]}'
</code></pre>
