'elasticsearch installation in helm fails with statefulset error

I'm installing elasticsearch in my EKS cluster using below commands

helm repo add elastic https://helm.elastic.co
curl -O https://raw.githubusercontent.com/elastic/helm-charts/master/elasticsearch/values.yaml
helm install --name elasticsearch elastic/elasticsearch -f ./values.yaml

It fails with below error

Error: template: elasticsearch/templates/statefulset.yaml:298:27: executing "elasticsearch/templates/statefulset.yaml" at <.Values.roles.master>: can't evaluate field master in type interface {}



Solution 1:[1]

I got the same issue. It was due to the following PR which change the role settings.

Documentation on master branch describes the new settings but it is not compatible with the last published chart version (7.13.2). Use instead values from the version you are using

helm repo add elastic https://helm.elastic.co
helm repo update
helm search repo elastic/elasticsearch

NAME                    CHART VERSION   APP VERSION     DESCRIPTION                                  
elastic/elasticsearch   7.13.2          7.13.2          Official Elastic helm chart for Elasticsearch

So use values.yaml from 7.13 branch

curl -O https://raw.githubusercontent.com/elastic/helm-charts/7.13/elasticsearch/values.yaml

Solution 2:[2]

For the ones wondering about @greenmaid's answer: this error happens because of the roles format changed. Use something like

roles:
  master: "true"
  ingest: "true"
  data: "true"

instead of

roles:
  - master
  - ingest
  - data

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Greenmaid
Solution 2 leberknecht