<p>Yesterday, I installed kubernetes microk8s on my private laptop to learn about kubernetes,
But even on first simple file with PersistentVolume I'm getting a lot of validation errors,</p>
<p>I have installed microk8s on Ubuntu from below source:
<a href="https://microk8s.io/?_ga=2.70856272.1723042697.1642604373-620897147.1642604373v" rel="nofollow noreferrer">https://microk8s.io/?_ga=2.70856272.1723042697.1642604373-620897147.1642604373v</a></p>
<p>The issue is when firstly I wanted to create pv:</p>
<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
name: redis-pv
spec:
storageClassName: &quot;&quot;
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: &quot;/mnt/data&quot;
</code></pre>
<p>and I'm gettting below errors:</p>
<pre><code>kubectl apply -f pv-data.yml -n testing

error: error validating &quot;pv-data.yml&quot;: error validating data: [ValidationError(PersistentVolume): unknown field &quot;accessModes&quot; in io.k8s.api.core.v1.PersistentVolume, ValidationError(PersistentVolume): unknown field &quot;name&quot; in io.k8s.api.core.v1.PersistentVolume, ValidationError(PersistentVolume): unknown field &quot;path&quot; in io.k8s.api.core.v1.PersistentVolume, ValidationError(PersistentVolume): unknown field &quot;storage&quot; in io.k8s.api.core.v1.PersistentVolume, ValidationError(PersistentVolume): unknown field &quot;storageClassName&quot; in io.k8s.api.core.v1.PersistentVolume]; if you choose to ignore these errors, turn validation off with --validate=false
</code></pre>
<p>Can someone help me with that ? Maybe I have microk8s not properly installed ? Because this is very simple yaml file.</p>
<p>also I would like to attach status of microk8s:</p>
<pre><code>microk8s status

microk8s is running
high-availability: no
  datastore master nodes: 127.0.0.1:19001
  datastore standby nodes: none
addons:
  enabled:
    dashboard            # The Kubernetes dashboard
    dns                  # CoreDNS
    ha-cluster           # Configure high availability on the current node
    ingress              # Ingress controller for external access
    metrics-server       # K8s Metrics Server for API access to service metrics
  disabled:
    ambassador           # Ambassador API Gateway and Ingress
    cilium               # SDN, fast with full network policy
    dashboard-ingress    # Ingress definition for Kubernetes dashboard
    fluentd              # Elasticsearch-Fluentd-Kibana logging and monitoring
    gpu                  # Automatic enablement of Nvidia CUDA
    helm                 # Helm 2 - the package manager for Kubernetes
    helm3                # Helm 3 - Kubernetes package manager
    host-access          # Allow Pods connecting to Host services smoothly
    inaccel              # Simplifying FPGA management in Kubernetes
    istio                # Core Istio service mesh services
    jaeger               # Kubernetes Jaeger operator with its simple config
    kata                 # Kata Containers is a secure runtime with lightweight VMS
    keda                 # Kubernetes-based Event Driven Autoscaling
    knative              # The Knative framework on Kubernetes.
    kubeflow             # Kubeflow for easy ML deployments
    linkerd              # Linkerd is a service mesh for Kubernetes and other frameworks
    metallb              # Loadbalancer for your Kubernetes cluster
    multus               # Multus CNI enables attaching multiple network interfaces to pods
    openebs              # OpenEBS is the open-source storage solution for Kubernetes
    openfaas             # OpenFaaS serverless framework
    portainer            # Portainer UI for your Kubernetes cluster
    prometheus           # Prometheus operator for monitoring and logging
    rbac                 # Role-Based Access Control for authorisation
    registry             # Private image registry exposed on localhost:32000
    storage              # Storage class; allocates storage from host directory
    traefik              # traefik Ingress controller for external access
</code></pre>

dominbdg
<p>Issue related to yaml indentation , you can use valid online examples like</p>
<p><a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/</a></p>
<p>or just try fix it on your intuition , most of time you can make it done</p>
<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
 name: redis-pv
spec:
 storageClassName: &quot;&quot;
 capacity:
   storage: 1Gi
 accessModes:
 - ReadWriteOnce
 hostPath:
   path: &quot;/mnt/data&quot;
</code></pre>
