Changing Microk8s' default hostpath addon storage location

Hello everyone, This is a short guide on how to change Microk8sā€™ default storage path for the hostpath addon. First, ensure the addon is enabled: 1 microk8s enable hostpath-storage Then create a new directory in which you want to store volumes created in the Microk8s instance. 1 mkdir -p /var/microk8s-volumes Then create and apply the storage class yaml file: 1 2 3 4 5 6 7 8 9 kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: custom-storageclass provisioner: microk8s.io/hostpath reclaimPolicy: Retain parameters: pvDir: /var/microk8s-volumes volumeBindingMode: WaitForFirstConsumer To change the default storage class for Microk8s you need to run these commands: ...

August 9, 2024 Ā· 1 min Ā· Denis Nutiu