<p>I am doing some testing and has to filter only the volume information of respective k8s pod. I used kubectl describe po | grep volumes. But it is only displaying <code>volumes:</code></p>
<p>Can someone suggest how can I filter the complete volume data from kubectl describe po command?</p>
<p>Complete Volume data  in kubectl describe command is below</p>
<pre><code>Volumes:
  config-volume:
    Type:      XXX (a volume populated by XXX)
    Name:     Volum-1
    Optional:  false
  Volum-1:
    Type: YYY (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  &lt;unset&gt;
  default-token-zzz:
    Type:        www (a volume populated by a www)
    SecretName:  default-token-zzz
    Optional:    false
</code></pre>

elset george
<p><code>kubectl describe</code> output is &quot;human readable&quot;, which is not that easy to parse, but also it does not guarantee you a consistent format over different releases. If you want to programmatically get some information from kubectl, you should use <code>kubectl get</code> with either <code>-o jsonpath</code> or <code>-o go-template</code></p>
<p>For example, to get all volumes you can use something like</p>
<pre><code>kubectl get pod your_pod -o jsonpath='{.spec.volumes}'
</code></pre>
<p>To get volume names use</p>
<pre><code>kubectl get pod your_pod -o jsonpath='{.spec.volumes[*].name}'
</code></pre>
<p>See <a href="https://kubernetes.io/docs/reference/kubectl/jsonpath/" rel="nofollow noreferrer">https://kubernetes.io/docs/reference/kubectl/jsonpath/</a> for reference</p>
