consul-on-kubernetes icon indicating copy to clipboard operation
consul-on-kubernetes copied to clipboard

Creating Persistent Volumes

Open blachniet opened this issue 7 years ago • 3 comments

I had to manually create persistent volumes in order to get this example to work. Is that expected, or is there likely something wrong with my configuration of minikube?

If it's expected that the user should manually create the persistent volumes, I'd be happy to update the instructions and share my example. Here's what I did:

kubectl create -f pv.yaml
# pv.yaml
kind: PersistentVolume
apiVersion: v1
metadata:
  name: pv0
  labels:
    type: local
spec:
  storageClassName: default
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/tmp/data/pv0"
---
kind: PersistentVolume
apiVersion: v1
metadata:
  name: pv1
  labels:
    type: local
spec:
  storageClassName: default
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/tmp/data/pv1"
---
kind: PersistentVolume
apiVersion: v1
metadata:
  name: pv2
  labels:
    type: local
spec:
  storageClassName: default
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/tmp/data/pv2"

blachniet avatar Aug 05 '17 13:08 blachniet

@blachniet how did you tie back the PVs to the stateful set? Since even after creating the PVs I am getting the same error as before i.e.

SchedulerPredicates failed due to PersistentVolumeClaim is not bound: "data-consul-0", which is unexpected., SchedulerPredicates failed due to PersistentVolumeClaim is not bound: "data-consul-0", which is unexpected., SchedulerPredicates failed due to PersistentVolumeClaim is not bound: "data-consul-0", which is unexpected.`

tankchintan avatar Oct 06 '17 21:10 tankchintan

I don't think that there was anything else I needed to do in order to tie the stateful set to the PVs. The persistent volumne claims in the stateful set should match to the PVs created by this configuration.

blachniet avatar Oct 09 '17 01:10 blachniet

@blachniet yes, I met this problem as well, and manually created 3 PVs to make it work

@tankchintan agree with @blachniet , PVC will automatically select from the PV pools (make sure you have 3 available, also I don't set storageClassName: default

larrycai avatar Nov 01 '17 17:11 larrycai