-2

I am on EKS 1.24 and using ElasticSearch 6.5.4 helm chart. I followed below steps to make updates to the disk size.

volumeClaimTemplates:
  - metadata:
      name: elasticsearch-data
    spec:
      {{ if and (.Values.enableEncryption) (eq .Values.enableEncryption true) }}
      storageClassName: gp2-encrypted
      {{ end }}
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: {{ .Values.volumeSize }}Gi
  1. Updated spec.resources.requests.storage under helm/templates to the new desired value
  2. Performed helm upgrade
  3. I got below error
Error: UPGRADE FAILED: cannot patch "elasticsearch" with kind StatefulSet: StatefulSet.apps "elasticsearch" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'template', 'updateStrategy', 'persistentVolumeClaimRetentionPolicy' and 'minReadySeconds' are forbidden

Possible solutions -

  1. Delete the existing statefulset and apply new one with updated values - kubectl delete statefulset elasticsearch && kubectl apply -f new-statefulset.yaml
  2. Deploy ES in multi-mode where Master, data and client will have a separate role

Now I am looking for a solution where I can handle it in existing helm chart configuration instead of converting my helm chart to multi

Darshan Deshmukh
  • 353
  • 1
  • 4
  • 15
  • That error message says you can't change the `storage:` capacity after the StatefulSet has already been created. – David Maze Jun 21 '23 at 11:22
  • I understand that this is Kubernetes limitations and there is open PR https://github.com/kubernetes/enhancements/pull/3412. But since this is very common use case to bump up the size of disk and we dont want to do this manually every time by patching PVC `kubectl patch pvc {{ template "elasticsearch.fullname" . }}-data -p '{"spec":{"resources":{"requests":{"storage":"2Gi"}}}}' ` – Darshan Deshmukh Jun 21 '23 at 13:12

1 Answers1

0

I was able to follow below process to upgrade the disk size (manual) to avoid any downtime -

  1. kubectl delete sts <statefulset-name> --cascade=orphan (which will make sure the elasticsearch pods are in running state always)

  2. kubectl patch pvc {{ template "elasticsearch.fullname" . }}-data -p '{"spec":{"resources":{"requests":{"storage":"10Gi"}}}}' [This will patch existing PVC to new disk size]

  3. Then recreate sts with new updated disk size. [Either apply helm upgrade with new disk size OR apply kubectl apply -f newsts.yaml

Darshan Deshmukh
  • 353
  • 1
  • 4
  • 15