title: How to parse kubectl describe output and get the required field value
body: <p>I am trying to fetch Nodeport from a specific pod using kubectl describe command. I came to know from this <a href="https://stackoverflow.com/questions/37464518/how-to-format-the-output-of-kubectl-describe-to-json">question</a> that -o option doesn't work with describe, hence I am trying with following way but I am not getting required value, can someone correct me.</p>
  
  <pre><code>kubectl -n core describe svc/pg-debug
  Name:                     pg-debug
  Namespace:                core
  Labels:                   &lt;none&gt;
  Annotations:              &lt;none&gt;
  Selector:                 app=postgresql-default
  Type:                     NodePort
  IP:                       172.17.17.19
  Port:                     &lt;unset&gt;  5432/TCP
  TargetPort:               5432/TCP
  NodePort:                 &lt;unset&gt;  24918/TCP
  Endpoints:                172.16.90.10:5432
  Session Affinity:         None
  External Traffic Policy:  Cluster
  Events:                   &lt;none&gt;
  </code></pre>
  
  <p>Following is the command that i am trying to get the value <code>"24918"</code></p>
  
  <pre><code>kubectl -n core describe svc/pg-debug | grep NodePort |awk -F:  '/nodePort/{gsub(/ /,"",$2)}'
  </code></pre>