<p>Hello I installed Microk8s Kubernetes on Ubuntu 18 single node machine and I was wondering how to change the storage location. I want all the containers / pods to be created in /dev/sdc volume which is ext4 format instead of default location.</p>

<p>In MicroK8s container data are kept under  <code>/var/snap/microk8s/common/var/lib/containerd</code>  and  <code>/var/snap/microk8s/common/run/</code>. If you do a  <code>df -h</code>  you should see that the filesystem holding those paths (probably the root filesystem) is running low on disk space. If you want to use other volumes with free disk space  you have to configure MicroK8s accordingly. Edit <code>/var/snap/microk8s/current/args/containerd</code>  and point the  <code>--root</code>  and  <code>--state</code>  to the volume you want to use. Here is an example with the  <code>/mnt</code></p>
<pre><code>--config ${SNAP_DATA}/args/containerd.toml
--root /mnt/var/lib/containerd
--state /mnt/run/containerd
--address ${SNAP_COMMON}/run/containerd.sock

</code></pre>
<p>After that you must restart MicroK8s for this configuration to take effect. Execute: <code>microk8s.stop</code>,  <code>microk8s.start</code>.</p>
<p>But the simplest answer is to specify <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/#create-a-persistentvolume" rel="noreferrer">host path</a> directly in your PV yaml spec - perfect for single node microk8s.</p>
<p>Take a look: <a href="https://github.com/ubuntu/microk8s/issues/463#issuecomment-491285745" rel="noreferrer">microk8s-storage</a>, <a href="https://stackoverflow.com/questions/58615019/how-to-change-a-kubernetes-hostpath-provisioner-mount-path">-hostpath-provisioner-mount-path</a>.</p>
