<p>Right now i use docker-compose for development. This is a great tool that comes handy if i use it on simple projects where i got maximum of 3-6 active services but when it comes to 6-8 and more it is become hard to manage.</p>
<p>So i've started to learn k8s on minikube and now i got few questions about some questions:</p>
<ol>
<li><p>How to make &quot;two-way&quot; binding for volumes? for example if i have folder named &quot;my-frontend&quot; and i want to sync specific folder in deployment, how to &quot;link&quot; them using PV and PVC ?</p>
</li>
<li><p>Very often it comes handy to make some service with specific environment like node:12.0.0 and then use it as command executor like this: <code>docker-compose run workspace npm install </code><br />
how to achieve something like this using k8s?</p>
</li>
</ol>

Bohdan Stasiv
<blockquote>
<p>How to make &quot;two-way&quot; binding for volumes? for example if i have folder named &quot;my-frontend&quot; and i want to sync specific folder in deployment, how to &quot;link&quot; them using PV and PVC ?</p>
</blockquote>
<p>You need to create a <code>PersistentVolume</code> which in your case will use a specific directory in the host, in Kubernetes <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/#create-a-persistentvolume" rel="nofollow noreferrer">official documentation</a> there's an example with this same use case.</p>
<p>Then a <code>PersistentVolumeClaim</code> to request some space from this volume (also an example in the previous documentation) and then mount the PVC on the pod/deployment where you need it.</p>
<pre><code>  volumes:
    - name: my-volume
      persistentVolumeClaim:
        claimName: my-pvc
  containers:
      ....
      volumeMounts:
        - mountPath: &quot;/mount/path/in/pod&quot;
          name: my-volume
</code></pre>
<blockquote>
<p>Very often it comes handy to make some service with specific environment like node:12.0.0 and then use it as command executor like this: docker-compose run workspace npm install
how to achieve something like this using k8s?</p>
</blockquote>
<p>You need to use <code>kubectl</code>, it has very similar functionalities as docker CLI, it also supports <a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#run" rel="nofollow noreferrer">run command</a> with very similar parameters and functionality. Alternatively, you can start your pod once and then run commands multiple times in the same instance by using <a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#exec" rel="nofollow noreferrer">kubectl exec</a></p>
