Crashback loop off in ECK when using PVC elasticsearch-data

Hello

I am trying to use PVC as given in documentation here. But it seems to throw the below error.
Error

2020-08-30 12:32:59,896 main ERROR No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property 'log4j2.debug' to show Log4j 2 internal initialization logging. See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2
Exception in thread "main" SettingsException[Failed to load settings from [elasticsearch.yml]]; nested: IllegalStateException[only value lists are allowed in serialized settings];
	at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1139)
	at org.elasticsearch.common.settings.Settings$Builder.loadFromPath(Settings.java:1112)
	at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:100)
	at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:95)
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
	at org.elasticsearch.cli.Command.main(Command.java:90)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
Caused by: java.lang.IllegalStateException: only value lists are allowed in serialized settings
	at org.elasticsearch.common.settings.Settings.fromXContent(Settings.java:692)
	at org.elasticsearch.common.settings.Settings.fromXContent(Settings.java:650)
	at org.elasticsearch.common.settings.Settings.access$500(Settings.java:82)
	at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1135)
	... 8 more

My elasticsearch yaml looks like this.

nodeSets:
  - name: masters-zone-a
    count: 3
    config:
      node.master: true
      node.data: false
      node.ingest: false
      volumeClaimTemplates:
      - metadata:
          name: elasticsearch-data
        spec:
          accessModes:
          - ReadWriteOnce
          resources:
            requests:
              storage: 5Gi
          storageClassName: standard
    podTemplate:
      spec:
        initContainers:
        - name: sysctl
          securityContext:
            privileged: true
          command: ['sh', '-c', 'sysctl -w vm.max_map_count=262144']
        containers:
        - name: elasticsearch
          env:
          - name: PROCESSORS
            valueFrom:
              resourceFieldRef:
                divisor: "0"
                resource: limits.cpu
          - name: ES_JAVA_OPTS
            value: '-Djava.net.preferIPv4Stack=true -Xms512m -Xmx512m  '
          - name: MINIMUM_MASTER_NODES
            value: "2"
          resources:
            requests:
              cpu: 200m
              memory: 3Gi
            limits:
              cpu: 500m
              memory: 3Gi
          volumeMounts:
          - mountPath: /usr/share/elasticsearch/config/jvm.options
            name: config
            subPath: jvm.options
          - mountPath: /usr/share/elasticsearch/config/log4j2.properties
            name: config
            subPath: log4j2.properties
        volumes:
        - configMap:
            name: elasticsearch-config
          name: config

I have already applied my elasticsearch-config as configmap but still this error is happening. Can anyone please help me understand the error.

The config attribute must only contain configuration that goes into elasticsearch.yml you also put the volumeClaimTemplate in there which is a Kubernetes thing, so it needs to go one level up:

nodeSets:
  - name: masters-zone-a
    count: 3
    config:
      node.master: true
      node.data: false
      node.ingest: false
    volumeClaimTemplates:
    - metadata:
         name: elasticsearch-data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests
            storage: 5Gi
        storageClassName: standard
2 Likes

Thanks @pebrc
It was indentation typo.