I'm running EFK stack in my EKS cluster however when i restart elasticsearch and access kibana all my previous data are lost including index-pattern and saved objects
Here is my elasticsearch file :
apiVersion: v1
kind: ConfigMap
metadata:
name: elasticsearch-config
namespace: tools
data:
elasticsearch.yml: |
cluster:
name: ${CLUSTER_NAME:elasticsearch-default}
initial_master_nodes: ${CLUSTER_INITIAL_MASTER_NODES}
node:
master: ${NODE_MASTER:true}
data: ${NODE_DATA:true}
name: ${NODE_NAME}
ingest: ${NODE_INGEST:true}
max_local_storage_nodes: ${MAX_LOCAL_STORAGE_NODES:1}
processors: ${PROCESSORS:1}
path:
data: ${DATA_PATH:"/usr/share/elasticsearch/data"}
repo: ${REPO_LOCATIONS:[]}
bootstrap:
memory_lock: ${MEMORY_LOCK:false}
http:
cors:
enabled: ${HTTP_ENABLE:true}
allow-origin: "*"
network:
host: "0.0.0.0"
discovery:
zen:
ping.unicast.hosts: ${DISCOVERY_SERVICE:elasticsearch-discovery}
minimum_master_nodes: ${NUMBER_OF_MASTERS:1}
xpack:
license.self_generated.type: basic
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: elasticsearch
namespace: tools
spec:
selector:
matchLabels:
app: elasticsearch
serviceName: elasticsearch
replicas: 3
template:
metadata:
labels:
app: elasticsearch
spec:
initContainers:
- name: set-dir-owner
image: busybox
command: ['sh', '-c', 'chown -R 1000:1000 /usr/share/elasticsearch/data']
volumeMounts:
- name: elasticsearch-volume
mountPath: /usr/share/elasticsearch/data
- image: alpine:3.6
command: ["/sbin/sysctl", "-w", "vm.max_map_count=262144"]
name: elasticsearch-init
securityContext:
privileged: true
containers:
- name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.0
ports:
- containerPort: 9200
name: http
protocol: TCP
- containerPort: 9300
name: transport
protocol: TCP
env:
- name: "CLUSTER_NAME"
valueFrom:
configMapKeyRef:
name: tools-config
key: CLUSTER_NAME
- name: "DISCOVERY_SERVICE"
valueFrom:
configMapKeyRef:
name: tools-config
key: DISCOVERY_SERVICE
- name: "CLUSTER_INITIAL_MASTER_NODES"
valueFrom:
configMapKeyRef:
name: tools-config
key: CLUSTER_INITIAL_MASTER_NODES
- name: NODE_MASTER
valueFrom:
configMapKeyRef:
name: tools-config
key: NODE_MASTER
- name: NODE_DATA
valueFrom:
configMapKeyRef:
name: tools-config
key: NODE_DATA
- name: HTTP_ENABLE
valueFrom:
configMapKeyRef:
name: tools-config
key: HTTP_ENABLE
- name: ES_JAVA_OPTS
valueFrom:
configMapKeyRef:
name: tools-config
key: ES_JAVA_OPTS
- name: "NODE_NAME"
valueFrom:
fieldRef:
fieldPath: metadata.name
readinessProbe:
httpGet:
scheme: HTTP
path: /_cluster/health?local=true
port: 9200
initialDelaySeconds: 29
volumeMounts:
- name: elasticsearch-volume
mountPath: /usr/share/elasticsearch/data
- name: elasticsearch-config
mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
subPath: elasticsearch.yml
volumes:
- name: elasticsearch-volume
persistentVolumeClaim:
claimName: elasticsearch-storage-pvc
- name: elasticsearch-config
configMap:
name: elasticsearch-config
---
apiVersion: v1
kind: Service
metadata:
name: elasticsearch
namespace: tools
spec:
clusterIP: None
selector:
app: elasticsearch
ports:
- name: http
protocol: TCP
port: 9200
- name: transport
protocol: TCP
port: 9300
type: ClusterIP