MicroK8s resize default storage Persistent Volumes

By default microk8s will create 20GiB disk space, If you need to expand it, you will have to

Describe pv and patch it

microk8s.kubectl get pv

NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                               STORAGECLASS        VOLUMEATTRIBUTESCLASS   REASON   AGE
pvc-ed8babeb-6292-406c-a664-289683549f1a   20Gi       RWX            Delete           Bound    container-registry/registry-claim   microk8s-hostpath   <unset>                          47m

Replace it with storage class id

microk8s.kubectl patch pv <YOUR STORAGE CLASS ID> -p '{"spec":{"capacity":{"storage":"25Gi"}}}'

persistentvolume/pvc-ed8babeb-6292-406c-a664-289683549f1a patched

Check again the patch is succeed

microk8s.kubectl get pv

NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                               STORAGECLASS        VOLUMEATTRIBUTESCLASS   REASON   AGE
pvc-ed8babeb-6292-406c-a664-289683549f1a   25Gi       RWX            Delete           Bound    container-registry/registry-claim   microk8s-hostpath   <unset>                          48m

Reference

  1. https://articles.maximemoreillon.com/articles/567