<p>I'm fighting since many hours setting my k8s pods on my <code>minikube</code> single node, at persistent volume creation stage.</p>

<p>This command always ends with error, even if I copy/paste the example spec from <code>kubernetes</code> documentation :</p>

<pre><code>$kubectl apply -f pv-volume.yml
</code></pre>

<blockquote>
  <p>error: SchemaError(io.k8s.api.core.v1.ScaleIOVolumeSource): invalid
  object doesn't have additional properties</p>
</blockquote>

<pre><code>$cat pv-volume.yml
kind: PersistentVolume
apiVersion: v1
metadata:
  name: task-pv-volume
  labels:
    type: local
spec:
  storageClassName: manual
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/data"
</code></pre>

<p>I can't figure out why kubectl obliges me to specify <code>ScaleIO</code> in my spec, while I'm using local volume.</p>

<p>I've the same error specifying <code>storagaClassName</code> to <code>standard</code></p>

<p>Any idea about what can be the problem?</p>

<p>My versions :</p>

<pre><code>$minikube version
minikube version: v1.0.0

$kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.11", GitCommit:"637c7e288581ee40ab4ca210618a89a555b6e7e9", GitTreeState:"clean", BuildDate:"2018-11-26T14:38:32Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.0", GitCommit:"641856db18352033a0d96dbc99153fa3b27298e5", GitTreeState:"clean", BuildDate:"2019-03-25T15:45:25Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
</code></pre>

<p>In minikube , the dynamic provisioner is already there by default , you just need to create persistent volume claims using that Class.</p>

<pre><code>C02W84XMHTD5:Downloads iahmad$ minikube start
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
Loading cached images from config file.
C02W84XMHTD5:Downloads iahmad$ kubectl get nodes
NAME       STATUS   ROLES    AGE   VERSION
minikube   Ready    master   4d    v1.10.0
C02W84XMHTD5:Downloads iahmad$ 
C02W84XMHTD5:Downloads iahmad$ kubectl get storageclasses.storage.k8s.io 
NAME                 PROVISIONER                AGE
standard (default)   k8s.io/minikube-hostpath   4d
C02W84XMHTD5:Downloads iahmad$ 
C02W84XMHTD5:Downloads iahmad$ 
</code></pre>

<p>so for th data persistence to host , you just need a volume claim and use it on your kubernetes deployment.</p>

<p>example mysql volume claim using the built in minikube storage class.</p>

<pre><code>kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: mysql-volumeclaim
  annotations:
    volume.beta.kubernetes.io/storage-class: standard
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
</code></pre>

<p>Usage inside mysql deployment:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql
  labels:
    app: mysql
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mysql
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
        - image: mysql:5.6
          name: mysql
          env:
            - name: MYSQL_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: mysql
                  key: password
          ports:
            - containerPort: 3306
              name: mysql
          volumeMounts:
            - name: mysql-persistent-storage
              mountPath: /var/lib/mysql
      volumes:
        - name: mysql-persistent-storage
          persistentVolumeClaim:
            claimName: mysql-volumeclaim
</code></pre>
