In the kubernetes cluster, I trying to install the consul using helm. while installing the consul database using helm, there is a problem getting the bind for the persistent volume claim.
I looking for an alternate approach to use the maually created PVC using Helm. I am hoping there should be a way to define the pv, pvc name in the definitions file (templates) but I do not know how.
Could you help me how can I ask my consul-helm to use the PV,PVC that already exists(bind already)?
What file I have to update and what code I have to update?
Is it possible to enter the PV,PVC names in the values.yaml file?
Hi @get2arun,
The only way to use a pre-created PVC is to name them in the format Kubernetes expects:
data-<kubernetes namespace>-<release name>-consul-server-<ordinal>
For example, given a kube namespace of "vault" and a release name of "consul" and 5 servers, you need to create PVCs with names:
First delete Consul, then create the PVCs, then re-install Consul and it will use the pre-existing PVCs.
Thanks lkysow. I have below questions in order to proceed.
What I understand is, the PV can be created with any name and PVC name should have format like "data-vault-consul-consul-server-{0,1,2,3,4}" and there are 5 PVC to be created.
The questions, I have the below config to create the PV and it has the storage of 20G. For the claims 0-4, I used 3GB each using accessModes: ReadWriteOnce. The first claim is able to bind and other claims are in pending state. Is there anything I am missing?
root@desktop:~/github/consul# kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
consul-pv 20Gi RWO Retain Available manual 2s
root@desktop:~/github/consul# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
data-vault-consul-consul-server-0 Bound consul-pv 20Gi RWO manual 6s
data-vault-consul-consul-server-1 Pending manual 2s
root@desktop:~/github/helmcharts/consul# kubectl describe pvc data-vault-consul-consul-server-1
Name: data-vault-consul-consul-server-1
Namespace: vault
StorageClass: manual
Status: Pending
Volume:
Labels:
Annotations:
Finalizers: [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning ProvisioningFailed 2s (x4 over 47s) persistentvolume-controller storageclass.storage.k8s.io "manual" not found
Mounted By:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: data-vault-consul-consul-server-0
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
what is config for the storage class for consul? please suggest.
data-<namepace>-<release-name>-consul-server-0.The namespace is "vault". I cloned the consul github repo and modified the values.yaml to take the image from my registry. I am sure the storage class "manual" is causing/blocking the pvc to claim the volume. Is there any alternative solution to install the consul for the Hashicorp vault.
The directory structure is like below in the chart history. I do not know what you mean by release. Are you asking the release version like 1.5.3 or 1.6.2 etc.
-rwxr-xr-x 1 root root 3871 Dec 31 1969 values.yaml
-rwxr-xr-x 1 root root 18542 Dec 31 1969 README.md
-rwxr-xr-x 1 root root 591 Dec 31 1969 Chart.yaml
drwxr-xr-x 2 root root 4096 Nov 26 15:23 templates
When you run helm install you can specify a release name, e.g. helm install --name release-name. Otherwise helm will create a name for you. You can find the release name by running helm list.
Have you tried creating the storage class?
I can specify the release name "consul" then in the kubectl get pv, I could see the pvc like below.
persistentvolumeclaim/datadir-consul-0 Pending thin-disk 86s
so I think, i have to create the pvc like "datadir-consul-0", is it correct? But I have a question, I can only create the helm release only if storage class for consul pv is created correctly. what is the storageclass accessModes to be used for correctly provison the pvc for consul?
The storageclass is created using code below.
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: thin-disk
annotations:
storageclass.kubernetes.io/is-default-class: "true"
provisioner: kubernetes.io/vsphere-volume
parameters:
datastore: /kube
diskformat: thin
fstype: ext3
so I think, i have to create the pvc like "datadir-consul-0", is it correct?
I don't think so. The format is data-<namepace>-<release-name>-consul-server-0. So wouldn't you need data-vault-consul-consul-server-0? Because you told me your namespace was vault and your release-name is consul.
The access mode needs to be RWO
The format is data-
- -consul-server-0. So wouldn't you need data-vault-consul-consul-server-0?
As per the above statement, I expect helm to create the pvc like data-
persistentvolumeclaim/datadir-consul-0 Pending thin-disk 17m

Are you using this helm chart? Maybe you're using the other chart in the
helm stable repo?
On Mon, Dec 2, 2019, 2:02 PM arunp notifications@github.com wrote:
### The format is data---consul-server-0. So wouldn't you need
data-vault-consul-consul-server-0?
As per the above statement, I expect helm to create the pvc like
data---consul-server-0, instead it is creating the pvc like below.
persistentvolumeclaim/datadir-consul-0 Pending thin-disk 17m—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/hashicorp/consul-helm/issues/297?email_source=notifications&email_token=AAH4RPIDVX2NVJG6M3GRL2TQWWAXFA5CNFSM4JTZYXG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFVZGMA#issuecomment-560698160,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAH4RPJSUIMW5SIRHS33EF3QWWAXFANCNFSM4JTZYXGQ
.
Initially I used the stable release in the consul chart but I had the similar issue, so this chart, downloaded the zip archive and extracted it. Is that going to be a problem. Maybe the name of the pvc needs to be created based on the format that helm creates the release. I can try this tomorrow and confirm. However, I am not sure what is the storage class that I have to use to make the claim by the pvc using the code copied earlier in this post.
This is documented here now: https://www.consul.io/docs/platform/k8s/run.html#using-existing-persistent-volume-claims-pvcs-
@lkysow that document says page not found.
@abhishekkamal96 That document has moved to https://www.consul.io/docs/k8s/installation/platforms/self-hosted-kubernetes#predefined-persistent-volume-claims-pvcs.