kelseyhightower / consul-on-kubernetes

Running HashiCorp's Consul on Kubernetes
Apache License 2.0
601 stars 183 forks source link

Creating Persistent Volumes #17

Open blachniet opened 7 years ago

blachniet commented 7 years ago

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"
tankchintan commented 7 years ago

@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.`

blachniet commented 7 years ago

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.

larrycai commented 7 years ago

@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