<p>how can I describe this command in yaml format?</p>

<pre><code>kubectl create configmap somename --from-file=./conf/nginx.conf
</code></pre>

<p>I'd expect to do something like the following yaml, but it doesn't work </p>

<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: somename
  namespace: default
fromfile: ./conf/nginx.conf
</code></pre>

<p>any idea?</p>

Maoz Zadok
<p>That won't work, because kubernetes isn't aware of the local file's path. You can simulate it by doing something like this:</p>
<pre><code>kubectl create configmap --dry-run=client somename --from-file=./conf/nginx.conf --output yaml
</code></pre>
<p>The <code>--dry-run</code> flag will simply show your changes on stdout, and not make the changes on the server. This will output a valid configmap, so if you pipe it to a file, you can use that:</p>
<pre><code>kubectl create configmap --dry-run=client somename --from-file=./conf/nginx.conf --output yaml | tee somename.yaml
</code></pre>
