<p>Is there any way to share the directory/files to kubernetes container from your local system?</p>

<p>I have a deployment yaml file. I want to share the directory without using <code>kubectl cp</code>.</p>

<p>I tried with <code>configmap</code> but I later came to know that configmap can not have the whole directory but only a single file.</p>

<p>If anyone has any idea please share.</p>

<p>Please note: I do not want to host the file into minikube but I want to push the directory directly to container</p>

Akshay Sood
<p>I found a way.</p>

<p>We can specify the directory we want to add into container by using <code>hostPath</code> in <code>volumes</code></p>

<pre><code>      volumeMounts:
        - name: crypto-config
          mountPath: &lt;PATH IN CONTAINER&gt;
        - name: channel-artifacts
          mountPath: /opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
        - name: chaincode
          mountPath: /opt/gopath/src/github.com/chaincode
  volumes:
    - name: crypto-config
      hostPath:
        path: &lt;YOUR LOCAL DIR PATH&gt;
    - name: channel-artifacts
      hostPath:
        path: /Users/akshaysood/Blockchain/Kubernetes/Fabric/network/channel-artifacts
    - name: chaincode
      hostPath:
        path: /Users/akshaysood/Blockchain/Kubernetes/Fabric/network/chaincode
</code></pre>
