Trouble persisting data on kubernetes

Hi, I have a cluster with a data node and a master node, and I'm trying to retain our ES indices on Kubernetes when our cluster is created/deleted.

I've tried to change path.data per this post, but my deployment is failing with java.lang.IllegalArgumentException: unknown setting [xpack.security.enabled] please check that any required plugins are installed.

To change path.data, I created an elasticsearch.yml file and feed it to the cluster with a configMap. I am assuming, based on the error above, that my config file is not being recognized. What am I doing wrong?

elasticsearch.yml

    apiVersion: v1
    data:
      elasticsearch.yml: |
        cluster.name: elastic-devs
        node.name: ${HOSTNAME}
        discovery.zen.ping.unicast.hosts: elastic-master.default.svc.cluster.local
        node.master: false
        node.data: true
        node.ingest: false
        network.host: 0.0.0.0
        xpack.security.enabled: false
        path.data: /usr/share/elasticsearch/data
    kind: ConfigMap
    metadata:
      name: elasticsearch-configmap
      labels:
        app: elasticsearch-configmap
        area: devs
        role: nosql
        version: "6.1.4"
        environment: elastic

data-statefulset.yaml

    apiVersion: apps/v1beta1
    kind: StatefulSet
    metadata:
      name: elastic-data
      labels:
        app: elastic-data
        area: devs
        role: nosql
        version: "6.1.4"
        environment: elastic
    spec:
      serviceName: elastic-data
      replicas: 1
      updateStrategy:
        type: RollingUpdate
      template:
        metadata:
          labels:
            app: elastic-data
            area: devs
            role: nosql
            version: "6.1.4"
            environment: elastic
          annotations:
            pod.beta.kubernetes.io/init-containers: '[
              {
              "name": "sysctl",
                "image": "busybox",
                "imagePullPolicy": "IfNotPresent",
                "command": ["sysctl", "-w", "vm.max_map_count=262144"],
                "securityContext": {
                  "privileged": true
                }
              }
            ]'
        spec:
          terminationGracePeriodSeconds: 10
          securityContext:
            runAsUser: 1000
            fsGroup: 1000
          containers:
          - name: elastic-data
            image: docker.elastic.co/elasticsearch/elasticsearch:6.1.4
            env:
            - name: ES_JAVA_OPTS
              value: -Xms512m -Xmx512m
            command: ["/bin/bash", "-c", "~/bin/elasticsearch-plugin remove x-pack; sed -i.bak -e /xpack.license.self_generated.type/d config/elasticsearch.ym; elasticsearch"]
            resources:
              requests:
                memory: "512Mi"
              limits:
                memory: "1024Mi"
            ports:
            - containerPort: 9300
              name: transport
            - containerPort: 9200
              name: http
            volumeMounts:
            - name: data-volume
              mountPath: /usr/share/elasticsearch/data
            - name: elasticsearch-configmap
              mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
              subPath: elasticsearch.yml
            readinessProbe:
              tcpSocket:
                port: 9300
              initialDelaySeconds: 30
              periodSeconds: 30
              timeoutSeconds: 3
            livenessProbe:
              tcpSocket:
                port: 9300
              initialDelaySeconds: 30
              periodSeconds: 30
              timeoutSeconds: 3
          volumes:
          - name: data-volume
            persistentVolumeClaim:
              claimName: pvc-es
          - name: elasticsearch-configmap
            configMap:
              name: elasticsearch-configmap

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.