K8s and Helm: how can I find the PersistentVolumeClaim requirements when binding fails?

4/4/2020

I am trying to install Gitlab from their official Helm chart gitlab/gitlab. One of the sub-charts is the bitnami/postgresql chart. I have access to the source code of both charts.

$ helm install gitlab gitlab/gitlab \
  --set global.hosts.domain=mando \
  --set global.hosts.externalIP=192.168.1.2 \
  --set certmanager-issuer.email=my-email@gmail.com 
  --set global.edition=ce

When I try to install the Gitlab chart, several containers are created, and the PostgreSQL one fails to start due to an unbound PVC. I have tried creating several different PVs that might accommodate its requirement but none of them seem to work.

Events:
  Type     Reason            Age                From               Message
  ----     ------            ----               ----               -------
  Warning  FailedScheduling  23s (x14 over 8m)  default-scheduler  error while running "VolumeBinding" filter plugin for pod "gitlab-postgresql-0": pod has unbound immediate PersistentVolumeClaims

I can describe the PVC and get some information about it, but it's not clear from the output what is missing from my PVs or what I can do do make the claim successful.

[mando infra]$ kubectl describe pvc data-gitlab-postgresql-0
Name:          data-gitlab-postgresql-0
Namespace:     default
StorageClass:  
Status:        Pending
Volume:        
Labels:        app=postgresql
               release=gitlab
               role=master
Annotations:   <none>
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:      
Access Modes:  
VolumeMode:    Filesystem
Mounted By:    gitlab-postgresql-0
Events:
  Type    Reason         Age                     From                         Message
  ----    ------         ----                    ----                         -------
  Normal  FailedBinding  4m48s (x6324 over 26h)  persistentvolume-controller  no persistent volumes available for this claim and no storage class is set

So how can I find the PersistentVolumeClaim requirements when PV binding fails?

-- MisterStrickland
kubernetes
kubernetes-helm

2 Answers

4/5/2020

The storageClassName on your PVC must match the one on your PV. It might be worth describing your PV and confirming that these and other properties match.

-- Basil Paul
Source: StackOverflow

4/8/2020

As described in the gitlab documentation you have to manage storage on your own. You have to create storageclass, pv and pvcs by yourself.

It is recommended to use dynamic storage provisioning. Example StorageClass object for GCP:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
 name: CUSTOM_STORAGE_CLASS_NAME
provisioner: kubernetes.io/gce-pd
reclaimPolicy: Retain
parameters:
 type: pd-standard

After creating StorageClass you have to upgrade your chart by modifying following file with created storageClass:

gitlab:
 gitaly:
 persistence:
 storageClass: CUSTOM_STORAGE_CLASS_NAME
 size: 50Gi
postgresql:
 persistence:
 storageClass: CUSTOM_STORAGE_CLASS_NAME
 size: 8Gi
minio:
 persistence:
 storageClass: CUSTOM_STORAGE_CLASS_NAME
 size: 10Gi
redis:
 master:
 persistence:
 storageClass: CUSTOM_STORAGE_CLASS_NAME
 size: 5Gi

And the upgrade your chart

helm install -upgrade gitlab gitlab/gitlab -f HELM_OPTIONS_YAML_FILE
-- KFC_
Source: StackOverflow