Helm-charts: StorageClassName not working

Created on 10 Jun 2020  路  9Comments  路  Source: elastic/helm-charts

Chart version: elastic/elasticsearch: 7.7.1

Kubernetes version: 13.2

Kubernetes provider: None

Helm Version: v3.2.1

I am working with elasticsearch on kubernetes. I followed the README instructions to install elasticsearch.

Describe the bug:

Even when I change the storageClassName in volumeClaimTemplate. Every time new pod always shows: Volumes ClaimName: elasticsearch-master-elasticsearch-master-0, and pod has unbound immediate PersistentVolumeClaims (repeated 4 times).

Steps to reproduce:

  1. helm install release-name ./helm-charts/elasticsearch --set imageTag=7.7.1

Expected behavior:
Three pods are pending. When you type kubectl describe pod elasticsearch-master-0, it will show pod has unbound immediate PersistentVolumeClaims (repeated 4 times).

Provide logs and/or server output (if relevant):

Volumes:
  elasticsearch-master:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  elasticsearch-master-elasticsearch-master-0
    ReadOnly:   false
  default-token-lhrgq:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-lhrgq
    Optional:    false
QoS Class:       Guaranteed
Node-Selectors:  <none>
Tolerations:     <none>
Events:
  Type     Reason            Age                    From               Message
  ----     ------            ----                   ----               -------
  Warning  FailedScheduling  7m40s (x2 over 7m40s)  default-scheduler  pod has unbound immediate PersistentVolumeClaims (repeated 4 times)
elasticsearch question triagstale

Most helpful comment

Hello, I encountered a similar problem, and it looks like the statefulSet does not declare / use :

  • persistence.storageClass
  • persistence.size

It should be put somewhere in the statefulset volumeClaimTemplate : https://github.com/elastic/helm-charts/blob/7.9/elasticsearch/templates/statefulset.yaml#L26

One (of the many) way of doing it : https://github.com/goharbor/harbor-helm/blob/master/templates/database/database-ss.yaml#L105

Manually provisioning a volume works, but having the possibility to also manually configure the volume name with a property like persistence.volumeName would be nice !

Thanks !

All 9 comments

@Espade Did you modify the chart values.yml file directly?

Also, can you provide the output from the following:

  • helm get <release-name>
  • kubectl get pv
  • kubectl get pvc
  • kubectl get events
  1. helm get release-name
COMPUTED VALUES:
antiAffinity: hard
antiAffinityTopologyKey: kubernetes.io/hostname
clusterHealthCheckParams: wait_for_status=green&timeout=1s
clusterName: elasticsearch
envFrom: []
esConfig: {}
esJavaOpts: -Xmx1g -Xms1g
esMajorVersion: ""
extraContainers: []
extraEnvs: []
extraInitContainers: []
extraVolumeMounts: []
extraVolumes: []
fsGroup: ""
fullnameOverride: ""
httpPort: 9200
image: docker.elastic.co/elasticsearch/elasticsearch
imagePullPolicy: IfNotPresent
imagePullSecrets: []
imageTag: 7.7.1
ingress:
  annotations: {}
  enabled: false
  hosts:
  - chart-example.local
  path: /
  tls: []
initResources: {}
keystore: []
labels: {}
lifecycle: {}
masterService: ""
masterTerminationFix: false
maxUnavailable: 1
minimumMasterNodes: 2
nameOverride: ""
networkHost: 0.0.0.0
nodeAffinity: {}
nodeGroup: master
nodeSelector: {}
persistence:
  annotations: {}
  enabled: true
  storageClass: local-path
podAnnotations: {}
podManagementPolicy: Parallel
podSecurityContext:
  fsGroup: 1000
  runAsUser: 1000
podSecurityPolicy:
  create: false
  name: ""
  spec:
    fsGroup:
      rule: RunAsAny
    privileged: true
    runAsUser:
      rule: RunAsAny
    seLinux:
      rule: RunAsAny
    supplementalGroups:
      rule: RunAsAny
    volumes:
    - secret
    - configMap
    - persistentVolumeClaim
priorityClassName: ""
protocol: http
rbac:
  create: false
  serviceAccountName: ""
readinessProbe:
  failureThreshold: 3
  initialDelaySeconds: 10
  periodSeconds: 10
  successThreshold: 3
  timeoutSeconds: 5
replicas: 3
resources:
  limits:
    cpu: 1000m
    memory: 2Gi
  requests:
    cpu: 1000m
    memory: 2Gi
roles:
  data: "true"
  ingest: "true"
  master: "true"
schedulerName: ""
secretMounts: []
securityContext:
  capabilities:
    drop:
    - ALL
  runAsNonRoot: true
  runAsUser: 1000
service:
  annotations: {}
  httpPortName: http
  labels: {}
  labelsHeadless: {}
  loadBalancerIP: ""
  loadBalancerSourceRanges: []
  nodePort: ""
  transportPortName: transport
  type: ClusterIP
sidecarResources: {}
sysctlInitContainer:
  enabled: true
sysctlVmMaxMapCount: 262144
terminationGracePeriod: 120
tolerations: []
transportPort: 9300
updateStrategy: RollingUpdate
volumeClaimTemplate:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
  storageClassName: local-path
  1. kubectl get pv
pvc-871bcaa2-ab1b-11ea-8f64-ac1f6b803f42   30Gi       RWO            Delete           Bound    graph/data-graph-elasticsearch-data-0             local-path               13h
pvc-87413550-ab1b-11ea-8f64-ac1f6b803f42   4Gi        RWO            Delete           Bound    graph/data-graph-elasticsearch-master-0           local-path               13h
  1. kubectl get pvc
data-graph-elasticsearch-data-0               Bound     pvc-871bcaa2-ab1b-11ea-8f64-ac1f6b803f42   30Gi       RWO            local-path     13h
data-graph-elasticsearch-master-0             Bound     pvc-87413550-ab1b-11ea-8f64-ac1f6b803f42   4Gi        RWO            local-path     13h
elasticsearch-master-elasticsearch-master-0   Pending                                                                                       21h
elasticsearch-master-elasticsearch-master-1   Pending                                                                                       21h
elasticsearch-master-elasticsearch-master-2   Pending                                                                                       21h
  1. kubectl get events
37m         Warning   FailedScheduling   Pod                     pod has unbound immediate PersistentVolumeClaims (repeated 4 times)
37m         Warning   FailedScheduling   Pod                     pod has unbound immediate PersistentVolumeClaims (repeated 4 times)
37m         Warning   FailedScheduling   Pod                     pod has unbound immediate PersistentVolumeClaims (repeated 4 times)
  1. kubectl get pod
NAME                     READY   STATUS    RESTARTS   AGE
elasticsearch-master-0   0/1     Pending   0          12h
elasticsearch-master-1   0/1     Pending   0          12h
elasticsearch-master-2   0/1     Pending   0          12h

@Espade It looks like you're using the local-path storage class.

Have you installed the local-path-provisioner? [1]
Alternatively, you would need to manually provision the required persistent volumes to match the claims from the Helm chart.

[1] https://github.com/rancher/local-path-provisioner

Hello, I encountered a similar problem, and it looks like the statefulSet does not declare / use :

  • persistence.storageClass
  • persistence.size

It should be put somewhere in the statefulset volumeClaimTemplate : https://github.com/elastic/helm-charts/blob/7.9/elasticsearch/templates/statefulset.yaml#L26

One (of the many) way of doing it : https://github.com/goharbor/harbor-helm/blob/master/templates/database/database-ss.yaml#L105

Manually provisioning a volume works, but having the possibility to also manually configure the volume name with a property like persistence.volumeName would be nice !

Thanks !

I am preparing to deploy the ELK stack with helm. I'm a bit confused by the VolumeClaimTemplate in helm-charts/elasticsearch/values.yaml. There is no storageClassName in this template.

I am using the local path provisioner which is currently running and creates the storage class: local-path

Can I just add the storageClassName to the values file as follows:
volumeClaimTemplate:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "local-path"
resources:
requests:
storage: 30Gi

and everything should work? I was curious why there wasn't a placeholder in the volumeClaimTemplate for storageClassName.

I can create the volume and the claim in advance but would prefer to keep everything self-contained in the helm chart. If I add the storageClassName tag to the template that corresponds to the storage class used by my local path provisioner (which is running), can I avoid having to create the PV/PVCs in advance?

Can I just add the storageClassName to the values file as follows:
volumeClaimTemplate:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "local-path"
resources:
requests:
storage: 30Gi

Hi, @beckyjmcdabq,

Yes you can add storageClassName directly in volumeClaimTemplate value like in this example: https://github.com/elastic/helm-charts/blob/58bdd96312a08cf3e933ffa9afb3c7988c27dd80/elasticsearch/examples/kubernetes-kind/values.yaml#L18-L23

why there wasn't a placeholder in the volumeClaimTemplate for storageClassName.

Well I don't know why we forgot to add a commented value for it in the default value file https://github.com/elastic/helm-charts/blob/58bdd96312a08cf3e933ffa9afb3c7988c27dd80/elasticsearch/values.yaml#L93-L97

That's something that could be fixed with a single line PR (adding #storageClassName: "standard" to the default values file).

Would you be interested to create this PR?

Hello, I encountered a similar problem, and it looks like the statefulSet does not declare / use :

  • persistence.storageClass
  • persistence.size

It should be put somewhere in the statefulset volumeClaimTemplate : https://github.com/elastic/helm-charts/blob/7.9/elasticsearch/templates/statefulset.yaml#L26

One (of the many) way of doing it : https://github.com/goharbor/harbor-helm/blob/master/templates/database/database-ss.yaml#L105

Hi @Wykiki,
storageClass and size are part of volumeClaimTemplate value and not persistence value (see comment just above).

Manually provisioning a volume works, but having the possibility to also manually configure the volume name with a property like persistence.volumeName would be nice !

AFAIK, volumeName arent' compatible with volumeClaimTemplates for Statefulset.

Following StackOverflow, PVC generated by volumeClaimTemplates seem to rely on <Statefulset.volumeClaimTemplates.metadata.name>-<Statefulset.metadata.name>-<count> convention (see https://github.com/elastic/helm-charts/issues/518#issuecomment-726109728 for more details)

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

closing as stale, doc should be added later in #894

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jgato picture jgato  路  7Comments

ichasco-heytrade picture ichasco-heytrade  路  7Comments

davidkarlsen picture davidkarlsen  路  5Comments

naseemkullah picture naseemkullah  路  6Comments

melissajenner22 picture melissajenner22  路  6Comments