title: How to get the cluster IP of a kubernetes service
body: <p>I've created a service which wraps an nfs, and I need to get the cluster IP for it so that I can set it to persistent volumne using it.</p>
  
  <p>I know I can use the following to get this:</p>
  
  <pre><code>$ kubectl get svc nfs-server
  NAME                  TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)                      AGE
  nfs-server   ClusterIP   10.59.243.58   &lt;none&gt;        2049/TCP,20048/TCP,111/TCP   2m
  </code></pre>
  
  <p>What I want to know is, how do I extract that cluster IP in a bash script?  It's generated as part of a deployment process, so I can't just type it in to my persistent volume manifest.</p>