kubernetes on microk8s yaml file not working

Solution 1:

Issue related to yaml indentation , you can use valid online examples like

https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/

or just try fix it on your intuition , most of time you can make it done

apiVersion: v1
kind: PersistentVolume
metadata:
 name: redis-pv
spec:
 storageClassName: ""
 capacity:
   storage: 1Gi
 accessModes:
 - ReadWriteOnce
 hostPath:
   path: "/mnt/data"