# Trouble persisting data on kubernetes

**URL:** https://discuss.elastic.co/t/trouble-persisting-data-on-kubernetes/139071
**Category:** Elasticsearch
**Created:** [July 9, 2018, 1:05am UTC](https://discuss.elastic.co/t/trouble-persisting-data-on-kubernetes/139071 "2018-07-09T01:05:08Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Mike\_H](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mike_h/32/33104_2.png) [@Mike\_H](https://discuss.elastic.co/u/Mike_H)
#### Post date: [July 9, 2018, 1:05am UTC](https://discuss.elastic.co/t/trouble-persisting-data-on-kubernetes/139071/1 "2018-07-09T01:05:08Z")

</div>

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](https://discuss.elastic.co/t/deploy-elastic-search-with-kubernetes-statefulset-cannot-persist-the-index-data/126484), 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`

```auto
    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`

```auto
    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

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [August 6, 2018, 1:05am UTC](https://discuss.elastic.co/t/trouble-persisting-data-on-kubernetes/139071/2 "2018-08-06T01:05:14Z")

</div>

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