Where data nodes stored in ES Kuberenetes Statefulset

Hi All,

I have deploy Elasticsearch statefulset in my ubuntu terminal after that i check pod of elasticsearch and found that there is not folder with name of /usr/share/elasticsearch/data in ES pod. When i check logs it give me

caused by: java.lang.illegalstateexception: failed to create node environment azure kubernetes service
caused by: java.nio.file.accessdeniedexception: /usr/share/elasticsearch/data/nodes

And i dont know where data is stored in statefulset of pods any application if i take it maybe ES, postgres or rabbitmq. Just want to see where data is storing and what is the path of.

Here is the yaml of ES statefulset

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: fx-elasticsearch
spec:
  selector:
    matchLabels:
      app: fx-elasticsearch # has to match .spec.template.metadata.labels
  serviceName: "fx-elasticsearch"
  replicas: 1 # by default is 1
  template:
    metadata:
      labels:
        app: fx-elasticsearch # has to match .spec.selector.matchLabels
    spec:
      terminationGracePeriodSeconds: 10
      containers:
      - name: fx-elasticsearch
        image: elasticsearch:6.8.12
        ports:
        - containerPort: 9200
          name: elasticsearch
        envFrom:
           - configMapRef:
               name: elastic-config  
        volumeMounts:
        - name: elasticsearch-pv-storageclaim
          mountPath: "/usr/share/elasticsearch/data"
        
          name: fx-elasticsearch
        - mountPath: "/usr/share/elasticsearch/config/elasticsearch.yml"
          subPath: elasticsearch.yml
          name: elasticsearch-configfile
      
      volumes:
        - name: elasticsearch-configfile
          configMap:
            name: elasticsearch-config    
  volumeClaimTemplates:
  - metadata:
      name: fx-elasticsearch
    spec:
      accessModes: [ "ReadWriteOnce" ]
      storageClassName: manual
      resources:
        requests:
          storage: 1Gi

---

apiVersion: v1
kind: Service
metadata:
  name: fx-elasticsearch
  labels:
    app: fx-elasticsearch
spec:
  type: NodePort
#  type: ClusterIP
  ports:
   - port: 9200
  selector:
   app: fx-elasticsearch
  ports:
    - port: 9200
      name: fx-elasticsearch
    - port: 9300
      name: transport

And Here is the PVC and PV yaml file

apiVersion: v1
kind: PersistentVolume
metadata:
  name: elasticsearch-pv
  labels:
    type: local
spec:
  storageClassName: manual
  capacity:
    storage: 10G
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/elasticsearch/esdata"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    app: elasticsearch
  name: elasticsearch-pv-claim
spec:
  storageClassName: manual
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 10G

And here is the config yaml file

apiVersion: v1
kind: ConfigMap
metadata:
  name: elastic-config
  labels:
    app: elastcisearch
data:
  ELASTICSEARCH_HOST: fx-elasticsearch
  cluster.name: elasticsearch

Please do help me where is data storing of ES through statefulset
I want to see inside of POD of ES that data folder

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