# Deploy elasticsearch with ECK without pv or pvc

**URL:** <https://discuss.elastic.co/t/deploy-elasticsearch-with-eck-without-pv-or-pvc/227795>\
**Category:** Elastic Cloud on Kubernetes (ECK)\
**Created:** [April 13, 2020, 3:48pm UTC](https://discuss.elastic.co/t/deploy-elasticsearch-with-eck-without-pv-or-pvc/227795 "2020-04-13T15:48:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsbayne](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@tsbayne](https://discuss.elastic.co/u/tsbayne)\
**Post date:** [April 13, 2020, 3:48pm UTC](https://discuss.elastic.co/t/deploy-elasticsearch-with-eck-without-pv-or-pvc/227795/1 "2020-04-13T15:48:43Z")

</div>

We do not utilize PV or PVC in our environment. Any persistent storage is utilized via a smb connection to a fileserver. I had elasticsearch working as a poc, but now I can't figure out how to get the production setup we want. It's time to reach out to the community for guidance.

When following the quickstart, there is mention of being able to utilize an empty directory for the elasticsearch-data directory. This was the only way I ever got elasticsearch to deploy reliably at first. I then toyed with it enough to get it to work utilizing a host path. I mounted that host path to our file server. It was hacky, but it did work (I thought).

```auto
- name: elasticsearch-data
  hostPath: 
    path: /data/eck-elasticsearch

```

But I was wrong. The host path only works if the smb connection isn't made. If the smb share is mounted to the host path, deploying elasticsearch fails. Here are the relevant errors from the init-container:

```auto
chowning /usr/share/elasticsearch/data to elasticsearch:elasticsearch
chown: changing ownership of '/usr/share/elasticsearch/data': Permission denied
failed to change ownership of '/usr/share/elasticsearch/data' from root:root to elasticsearch:elasticsearch

```

Ultimately, what I would really like to do is connect the elasticsearch-data the same way we attach all our other persistent storage, but at this point I'll do whatever we can get working. As an example, for our apps that need persistent storage currently this is how we do it:

```auto
        volumeMounts:
        - name: data-mount
          mountPath: /usr/src/app/data
      volumes:
        - name: data-mount
          flexVolume:
            driver: "fstab/cifs"
            fsType: "cifs"
            secretRef:
              name: "secret"
            options:
              networkPath: "//server-name/share-name"
              mountOptions: "dir_mode=0755,file_mode=0644,noperm"

```

I see the same error in the init-container when I try to connect this way:

```auto
chowning /usr/share/elasticsearch/data to elasticsearch:elasticsearch
chown: changing ownership of '/usr/share/elasticsearch/data': Permission denied
failed to change ownership of '/usr/share/elasticsearch/data' from root:root to elasticsearch:elasticsearch

```

Thank you community for your help. You have always pointed me in the right direction when I seem completely turned around.

---

<div class="post-metadata">

**Author:** ![michael.morello](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michael.morello/32/47448_2.png) [@michael.morello](https://discuss.elastic.co/u/michael.morello)\
**Post date:** [April 14, 2020, 8:04am UTC](https://discuss.elastic.co/t/deploy-elasticsearch-with-eck-without-pv-or-pvc/227795/2 "2020-04-14T08:04:59Z")

</div>

Since we expect to have separate volumes for each Pod I don't think you can use the `volumes` field as you would do with a `Deployment` for example _(with the exception of `emptyDir` which is a special case)_.

I'm not sure there is another solution than using `PersistentVolumes` and setting the right `StorageClass` in the `volumeClaimTemplates` field.

---

<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:53am UTC](https://discuss.elastic.co/t/deploy-elasticsearch-with-eck-without-pv-or-pvc/227795/3 "2022-11-04T07:53:35Z")

</div>


