How to change microk8s kubernetes storage location How to change microk8s kubernetes storage location kubernetes kubernetes

How to change microk8s kubernetes storage location


In MicroK8s container data are kept under /var/snap/microk8s/common/var/lib/containerd and /var/snap/microk8s/common/run/. If you do a df -h 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 /var/snap/microk8s/current/args/containerd and point the --root and --state to the volume you want to use. Here is an example with the /mnt

--config ${SNAP_DATA}/args/containerd.toml--root /mnt/var/lib/containerd--state /mnt/run/containerd--address ${SNAP_COMMON}/run/containerd.sock

After that you must restart MicroK8s for this configuration to take effect. Execute: microk8s.stop, microk8s.start.

But the simplest answer is to specify host path directly in your PV yaml spec - perfect for single node microk8s.

Take a look: microk8s-storage, -hostpath-provisioner-mount-path.