# Deploy ECK with local storage

**URL:** <https://discuss.elastic.co/t/deploy-eck-with-local-storage/234086>\
**Category:** Elastic Cloud on Kubernetes (ECK)\
**Created:** [May 25, 2020, 7:01am UTC](https://discuss.elastic.co/t/deploy-eck-with-local-storage/234086 "2020-05-25T07:01:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Virajsl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/virajsl/32/48327_2.png) [@Virajsl](https://discuss.elastic.co/u/Virajsl)\
**Post date:** [May 25, 2020, 7:01am UTC](https://discuss.elastic.co/t/deploy-eck-with-local-storage/234086/1 "2020-05-25T07:01:42Z")

</div>

I am trying to deploy eck. My storage is in local disk. I wanted to create 3 master node cluster to begin with. My problem is do I need to  
create persistent volume and persistent volume claim for each master ?  
This is my storage class

```auto
kind: StorageClass
  apiVersion: storage.k8s.io/v1
  metadata:
    name: local-storage
  provisioner: kubernetes.io/no-provisioner
  volumeBindingMode: WaitForFirstConsumer

```

This is my pv

```auto
apiVersion: v1
    kind: PersistentVolume
    metadata:
      name: pv-test
    spec:
      capacity:
        storage: 2Gi
      accessModes:
      - ReadWriteOnce
      persistentVolumeReclaimPolicy: Retain
      storageClassName: local-storage-master
      local:
        path: /data/
      nodeAffinity:
        required:
          nodeSelectorTerms:
          - matchExpressions:
            - key: kubernetes.io/hostname
              operator: In
              values:
              - node-a
              - node-b
              - node-c

```

This is my ES cluster

```auto
apiVersion: elasticsearch.k8s.elastic.co/v1
  kind: Elasticsearch
  metadata:
    name: master-node-cluster
  spec:
    version: 7.7.0
    nodeSets:
    - name: default
      count: 3
      volumeClaimTemplates:
      - metadata:
          name: elasticsearch-data
        spec:
          accessModes:
          - ReadWriteOnce
          resources:
            requests:
              storage: 2Gi
          storageClassName: local-storage
      config:
        node.master: true
        node.data: true
        node.ingest: true
        node.store.allow_mmap: false

```

The problem is only one master nodes comes online. Other two wait in Pending states since they don't have pv. One master get pv and pvc. If this is  
the case then do i need to create yaml for each master specifying different storage-class ?

---

<div class="post-metadata">

**Author:** ![Virajsl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/virajsl/32/48327_2.png) [@Virajsl](https://discuss.elastic.co/u/Virajsl)\
**Post date:** [May 28, 2020, 5:48am UTC](https://discuss.elastic.co/t/deploy-eck-with-local-storage/234086/2 "2020-05-28T05:48:40Z")

</div>

Solution is to create pv for each node. I created 3 storage classes for master data and ingest. Then created pv for each node with relevant storage class.

---

<div class="post-metadata">

**Author:** ![liuxg](https://avatars.discourse-cdn.com/v4/letter/l/e36b37/32.png) [@liuxg](https://discuss.elastic.co/u/liuxg)\
**Post date:** [June 1, 2020, 12:55pm UTC](https://discuss.elastic.co/t/deploy-eck-with-local-storage/234086/3 "2020-06-01T12:55:21Z")

</div>

I had exactly the same issue with you. I followed the tutorials at [https://medium.com/@iced\_burn/elasticstack-in-kubernetes-57c37306a7bd](https://medium.com/@iced_burn/elasticstack-in-kubernetes-57c37306a7bd). I think it does not make it through. Can I create 3 nodes in the same yaml file? Or I should create each node one by one?

Could you please paste your answer?

Thanks & best regards,  
Xiaoguo

---

<div class="post-metadata">

**Author:** ![Virajsl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/virajsl/32/48327_2.png) [@Virajsl](https://discuss.elastic.co/u/Virajsl)\
**Post date:** [June 8, 2020, 11:52am UTC](https://discuss.elastic.co/t/deploy-eck-with-local-storage/234086/4 "2020-06-08T11:52:48Z")

</div>

First create storage classes

```
create local storage class
cat <<EOF | kubectl apply -f -
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: local-storage-master
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
EOF
-----
cat <<EOF | kubectl apply -f -
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: local-storage-data
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
EOF
------
cat <<EOF | kubectl apply -f -
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: local-storage-ingest
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
EOF

```

Then create pv for each node. Following for data node 1

```
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: PersistentVolume
metadata:
  name: es-data-pv-0
spec:
  capacity:
    storage: 2Gi
  accessModes:
  - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: local-storage-data
  local:
    path: /data/
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - worker1
          - worker2
          - worker3
 EOF

```

You need to create this PV for all the data nodes. If needed pv can be created for master as well.

---

<div class="post-metadata">

**Author:** ![pebrc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pebrc/32/101790_2.png) [@pebrc](https://discuss.elastic.co/u/pebrc)\
**Post date:** [June 8, 2020, 12:16pm UTC](https://discuss.elastic.co/t/deploy-eck-with-local-storage/234086/5 "2020-06-08T12:16:30Z")

</div>

There should be no need to create different storage classes for the different node types unless this is really what you wanted: e.g. cheap spinning disks for warm data nodes, fast solid state disks for hot data nodes and masters etc.

But reading through your post I don't think this is the case here. Have a look at this answer from @sebgl which lists a few options for local volume provisioning that will take the burden of managing persistent volumes manually from you:

> [@Best option for persistent volume of an on-premise ECK](https://discuss.elastic.co/t/best-option-for-persistent-volume-of-an-on-premise-eck/215611/2):
>
> Hi @Ali_Reza_Haghighat, You're right: we do not recommend NFS, which generally offers poor performance for Elasticsearch. We also have problems using Local volume (Pod crashes after a few document insertion) This seems a bit strange. How are you handling the local volumes? A few options you may want to look at: If you have any network-attached PersistentVolume provider available, that's by far the easiest option. GCP persistent disks and AWS ELBs now offer pretty good performance, depend…

---

<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:** [November 4, 2022, 7:59am UTC](https://discuss.elastic.co/t/deploy-eck-with-local-storage/234086/6 "2022-11-04T07:59:34Z")

</div>


