title: How to save content of a configmap to a file with kubectl and jsonpath?
body: <p>I'm trying to save the contents of a configmap to a file on my local hard drive. Kubectl supports selecting with JSONPath but I can't find the expression I need to select just the file contents.</p>
  
  <p>The configmap was created using the command</p>
  
  <pre><code>kubectl create configmap my-configmap --from-file=my.configmap.json=my.file.json
  </code></pre>
  
  <p>When I run </p>
  
  <pre><code>kubectl describe configmap my-configmap
  </code></pre>
  
  <p>I see the following output:</p>
  
  <pre><code>Name:         my-configmap 
  Namespace:    default 
  Labels:       &lt;none&gt; 
  Annotations:  &lt;none&gt;
  
  Data
  ==== 
  my.file.json:
  ---- 
  {
      "key": "value" 
  } 
  Events:  &lt;none&gt;
  </code></pre>
  
  <p>The furthest I've gotten so selecting only the file contents is this:</p>
  
  <pre><code> kubectl get configmap my-configmap -o jsonpath="{.data}"
  </code></pre>
  
  <p>Which outputs</p>
  
  <pre><code>map[my.file.json:{
      "key": "value"
  }]
  </code></pre>
  
  <p>The output that I want is </p>
  
  <pre><code>{
    "key": "value"
  }
  </code></pre>
  
  <p>What is the last piece of the JSONPath puzzle?</p>