title: Multiple persistent volumes in minikube
body: <p>I want to attach multiple volumeMounts to deployment in minikube on one persistent volume claim.</p>
  
  <p>I have a tomcat deployed app that needs to preserve three different folders (/var/log/app, /var/lib/app, /etc/app).
  When the container starts I should get files in every catalog but only logs get populated and the app fails.
  Any idea if my yaml is correct or am I approaching this the wrong way?</p>
  
  <p>K8s yaml:</p>
  
  <pre><code>apiVersion: v1
  
  kind: PersistentVolume
  metadata:
    name: pv-volume
  spec:
    accessModes:
      - ReadWriteOnce
    capacity:
      storage: 6Gi
    hostPath:
      path: /data/pv-volume
    storageClassName: manual
  ---
  apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: pv-claim
  spec:
    accessModes:
      - ReadWriteOnce
    resources:
      requests:
        storage: 5Gi
    storageClassName: manual
  ---
  apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: app
    labels:
      app: app
  spec:
    selector:
      matchLabels:
        app: app
    replicas: 1
    strategy: {}
    template:
      metadata:
        labels:
          app: app
      spec:
        containers:
        - image: app:latest
          name: app
          env:
          - name: JAVA_OPTS
            value: -Xms64M -Xmx512M
          ports:
          - containerPort: 8080
          resources:
            requests:
              memory: "512Mi"
              cpu: "250m"
            limits:
              memory: "1024Mi"
              cpu: "500m"
          volumeMounts:
            - name: pv-storage1
              mountPath: /var/log/app
              subPath: log
            - name: pv-storage1
              mountPath: /var/lib/app
              subPath: lib
            - name: pv-storage1
              mountPath: /etc/app
              subPath: etc
          tty: true
        volumes:
        - name: pv-storage1
          persistentVolumeClaim:
            claimName: pv-claim
        restartPolicy: Always
  status: {}
  </code></pre>
  
  <p>v2:</p>
  
  <pre><code>apiVersion: v1
  kind: PersistentVolume
  metadata:
    name: pv-volume-log
  spec:
    accessModes:
      - ReadWriteOnce
    capacity:
      storage: 1Gi
    hostPath:
      path: /data/pv-volume/log
    storageClassName: manual
  ---
  apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: pv-claim-log
  spec:
    accessModes:
      - ReadWriteOnce
    resources:
      requests:
        storage: 1Gi
    storageClassName: manual
  ---
  apiVersion: v1
  kind: PersistentVolume
  metadata:
    name: pv-volume-lib
  spec:
    accessModes:
      - ReadWriteOnce
    capacity:
      storage: 1Gi
    hostPath:
      path: /data/pv-volume/lib
    storageClassName: manual
  ---
  apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: pv-claim-lib
  spec:
    accessModes:
      - ReadWriteOnce
    resources:
      requests:
        storage: 1Gi
    storageClassName: manual
  ---
  apiVersion: v1
  kind: PersistentVolume
  metadata:
    name: pv-volume-etc
  spec:
    accessModes:
      - ReadWriteOnce
    capacity:
      storage: 1Gi
    hostPath:
      path: /data/pv-volume/etc
    storageClassName: manual
  ---
  apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: pv-claim-etc
  spec:
    accessModes:
      - ReadWriteOnce
    resources:
      requests:
        storage: 1Gi
    storageClassName: manual
  ---
  apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: endpoint
    labels:
      app: endpoint
  spec:
    selector:
      matchLabels:
        app: endpoint
    replicas: 1
    strategy: {}
    template:
      metadata:
        labels:
          app: endpoint
      spec:
        containers:
        - image: endpoint:latest
          name: endpoint
          env:
          - name: JAVA_OPTS
            value: -Xms64M -Xmx1024M
          ports:
          - containerPort: 8080
          resources:
            requests:
              memory: "1024Mi"
              cpu: "250m"
            limits:
              memory: "2048Mi"
              cpu: "500m"
          volumeMounts:
            - name: pv-storage-log
              mountPath: /var/log
            - name: pv-storage-lib
              mountPath: /var/lib
            - name: pv-storage-etc
              mountPath: /etc
          tty: true
        volumes:
        - name: pv-storage-log
          persistentVolumeClaim:
            claimName: pv-claim-log
        - name: pv-storage-lib
          persistentVolumeClaim:
            claimName: pv-claim-lib
        - name: pv-storage-etc
          persistentVolumeClaim:
            claimName: pv-claim-etc
        restartPolicy: Always
  status: {}
  </code></pre>