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.
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.