title: How to grep a yaml value
body: <p>I try to get a value from a YAML file within a shell:</p>
  
  <pre><code>apiVersion: v1
  items:
  - apiVersion: v1
    kind: Pod
    spec:
      containers:
      hostIP: 12.198.110.192
      phase: Running
      podIP: 10.244.1.9
  </code></pre>
  
  <p>With <code>kubectl get pods -l run=hello-kube -o yaml | grep podIP:</code> I get this ouput:</p>
  
  <pre><code>    podIP: 10.244.1.9
  </code></pre>
  
  <p>My goal is to save that value in a Environment Variable, but I only get the <code>key/value</code>-pair: </p>
  
  <pre><code>export PODIP=$(kubectl get pods -l run=hello-kube -o yaml | grep podIP)
  </code></pre>