# How to configure nfs in ECK k8s Rancher

**URL:** <https://discuss.elastic.co/t/how-to-configure-nfs-in-eck-k8s-rancher/213936>\
**Category:** Elastic Cloud on Kubernetes (ECK)\
**Created:** [January 6, 2020, 6:40pm UTC](https://discuss.elastic.co/t/how-to-configure-nfs-in-eck-k8s-rancher/213936 "2020-01-06T18:40:40Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marinho\_DevOPs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marinho_devops/32/45572_2.png) [@Marinho\_DevOPs](https://discuss.elastic.co/u/Marinho_DevOPs)\
**Post date:** [January 6, 2020, 6:40pm UTC](https://discuss.elastic.co/t/how-to-configure-nfs-in-eck-k8s-rancher/213936/1 "2020-01-06T18:40:40Z")

</div>

Hi  
I have a problem setting a volume in the all-in-one.yaml file. I am trying to map an ntfs to persist the external volume and not use the Elastic default.  
Could someone help me in this case.

My file.

apiVersion: apps/v1  
kind: StatefulSet  
metadata:  
name: elastic-operator  
namespace: elasticsearch-funcional  
labels:  
control-plane: elastic-operator  
spec:  
selector:  
matchLabels:  
control-plane: elastic-operator  
serviceName: elastic-operator  
template:  
metadata:  
labels:  
control-plane: elastic-operator  
spec:  
serviceAccountName: elastic-operator  
containers:  
- image: [docker.elastic.co/eck/eck-operator:1.0.0-beta1](http://docker.elastic.co/eck/eck-operator:1.0.0-beta1)  
volumeMounts:  
- name: elasticsearch-data  
mountPath: /usr/share/elasticsearch/data  
name: manager  
args: ["manager", "--operator-roles", "all", "--enable-debug-logs=true"]  
env:  
- name: OPERATOR\_NAMESPACE  
valueFrom:  
fieldRef:  
fieldPath: metadata.namespace  
- name: WEBHOOK\_SECRET  
value: webhook-server-secret  
- name: WEBHOOK\_PODS\_LABEL  
value: elastic-operator  
- name: OPERATOR\_IMAGE  
value: [docker.elastic.co/eck/eck-operator:1.0.0-beta1](http://docker.elastic.co/eck/eck-operator:1.0.0-beta1)  
resources:  
limits:  
cpu: 1  
memory: 150Mi  
requests:  
cpu: 100m  
memory: 50Mi  
ports:  
- containerPort: 9876  
name: webhook-server  
protocol: TCP  
terminationGracePeriodSeconds: 10  
volumes:  
- name: elasticsearch-data  
nfs:  
server: 192.168.134.137  
path: /nfs/dev/elastick8

---

<div class="post-metadata">

**Author:** ![Anya\_Sabo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anya_sabo/32/49903_2.png) [@Anya\_Sabo](https://discuss.elastic.co/u/Anya_Sabo)\
**Post date:** [January 6, 2020, 10:46pm UTC](https://discuss.elastic.co/t/how-to-configure-nfs-in-eck-k8s-rancher/213936/2 "2020-01-06T22:46:54Z")

</div>

Hey Marinho,  
It's hard to tell because it looks like the formatting was lost in the copy and paste (you can use code blocks with three `s btw), but I think multiple concepts might be conflated. The actual beta operator stateful set does not need persistent storage. The volume claim templates inside of the Elasticsearch resource (separate from the operator statefulset) can be configured like so: [https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-volume-claim-templates.html](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-volume-claim-templates.html)

---

<div class="post-metadata">

**Author:** ![sebgl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sebgl/32/48702_2.png) [@sebgl](https://discuss.elastic.co/u/sebgl)\
**Post date:** [January 7, 2020, 8:31am UTC](https://discuss.elastic.co/t/how-to-configure-nfs-in-eck-k8s-rancher/213936/3 "2020-01-07T08:31:10Z")

</div>

In other words: it looks like you configured the PersistentVolumes in the operator manifest, instead of configuring it in the Elasticsearch resource.

---

<div class="post-metadata">

**Author:** ![Marinho\_DevOPs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marinho_devops/32/45572_2.png) [@Marinho\_DevOPs](https://discuss.elastic.co/u/Marinho_DevOPs)\
**Post date:** [January 7, 2020, 5:26pm UTC](https://discuss.elastic.co/t/how-to-configure-nfs-in-eck-k8s-rancher/213936/4 "2020-01-07T17:26:30Z")

</div>

Thank you Anya.

I create the configuration nfs now on elasticsearch resource, look my configurition pv,pv and of elasticsearch.

## Elasticsearch#

apiVersion: [elasticsearch.k8s.elastic.co/v1beta1](http://elasticsearch.k8s.elastic.co/v1beta1)  
kind: Elasticsearch  
metadata:  
name: elasticsearch  
namespace: elasticsearch-funcional  
spec:  
version: 7.5.1  
nodeSets:

- name: es-cluster  
count: 1  
config:  
node.master: true  
node.data: false  
node.ingest: false
- name: es-data  
count: 1  
config:  
node.master: false  
node.data: true  
node.ingest: false  
podTemplate:  
spec:  
containers:  
- name: elasticsearch  
volumeMounts:  
- name: elasticsearch-data  
mountPath: /usr/share/elasticsearch/data  
env:  
- name: node.name  
valueFrom:  
fieldRef:  
fieldPath: metadata.name  
- name: discovery.zen.ping.unicast.hosts  
value: "es-cluster-0.elasticsearch,es-cluster-1.elasticsearch"  
- name: discovery.zen.minimum\_master\_nodes  
value: "2"  
- name: ES\_JAVA\_OPTS  
value: "-Xms2g -Xmx2g"  
initContainers:  
- name: sysctl  
securityContext:  
privileged: true  
command: ['sh', '-c', 'sysctl -w vm.max\_map\_count=262144']  
volumes:  
- name: elasticsearch-data  
persistentVolumeClaim:  
claimName: elasticsearch-data-elasticsearch-es-es-cluster-0

#PV

* * *

apiVersion: v1  
kind: PersistentVolume  
metadata:  
name: elasticsearch-data-elasticsearch-es-es-cluster-0  
namespace: elasticsearch-funcional  
spec:  
capacity:  
storage: 10Gi  
accessModes:  
- ReadWriteMany  
persistentVolumeReclaimPolicy: Recycle  
nfs:  
server: 192.168.134.137  
path: /nfs/dev/elastick8s

* * *

apiVersion: v1  
kind: PersistentVolume  
metadata:  
name: elasticsearch-data-elasticsearch-es-es-data-0  
namespace: elasticsearch-funcional  
spec:  
capacity:  
storage: 10Gi  
accessModes:  
- ReadWriteMany  
persistentVolumeReclaimPolicy: Recycle  
nfs:  
server: 192.168.134.137  
path: /nfs/dev/elastick8s

#PVC

* * *

apiVersion: v1  
kind: PersistentVolumeClaim  
metadata:  
name: elasticsearch-data-elasticsearch-es-es-cluster-0  
namespace: elasticsearch-funcional  
spec:  
accessModes:  
- ReadWriteMany  
resources:  
requests:  
storage: 4Gi

* * *

apiVersion: v1  
kind: PersistentVolumeClaim  
metadata:  
name: elasticsearch-data-elasticsearch-es-es-data-0  
namespace: elasticsearch-funcional  
spec:  
accessModes:  
- ReadWriteMany  
resources:  
requests:  
storage: 4Gi  
###########

I am trying to create a separate master and data cluster. But I'm getting the error that is unable to bound pvc mapping.

#ERROR#

Warning BackOff pod/elasticsearch-es-es-data-0 Back-off restarting failed container

---

<div class="post-metadata">

**Author:** ![sebgl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sebgl/32/48702_2.png) [@sebgl](https://discuss.elastic.co/u/sebgl)\
**Post date:** [January 8, 2020, 8:57am UTC](https://discuss.elastic.co/t/how-to-configure-nfs-in-eck-k8s-rancher/213936/5 "2020-01-08T08:57:56Z")

</div>

@Marinho_DevOPs can you arrange the formatting in your message so the yaml manifests appear with the correct indentation? I think you can wrap them in a [Markdown code block](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code-and-syntax-highlighting).

---

<div class="post-metadata">

**Author:** ![Marinho\_DevOPs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marinho_devops/32/45572_2.png) [@Marinho\_DevOPs](https://discuss.elastic.co/u/Marinho_DevOPs)\
**Post date:** [January 8, 2020, 10:43am UTC](https://discuss.elastic.co/t/how-to-configure-nfs-in-eck-k8s-rancher/213936/6 "2020-01-08T10:43:24Z")

</div>

@sebgl i can send my file to you for mail.

---

<div class="post-metadata">

**Author:** ![Marinho\_DevOPs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marinho_devops/32/45572_2.png) [@Marinho\_DevOPs](https://discuss.elastic.co/u/Marinho_DevOPs)\
**Post date:** [January 8, 2020, 10:50am UTC](https://discuss.elastic.co/t/how-to-configure-nfs-in-eck-k8s-rancher/213936/7 "2020-01-08T10:50:41Z")

</div>

![Captura de tela de 2020-01-08 07-49-04](https://us1.discourse-cdn.com/elastic/original/3X/f/5/f56203a9c9d97753671873fc0d3692c8254baa88.png) ![Captura de tela de 2020-01-08 07-49-30](https://us1.discourse-cdn.com/elastic/original/3X/4/7/470e5111b62f33e7774c2ad8e710fb4501db61f6.png) ![Captura de tela de 2020-01-08 07-49-47](https://us1.discourse-cdn.com/elastic/original/3X/3/2/320fcbb9e0b7d721900d967bd265fd94486f34b4.png) ![Captura de tela de 2020-01-08 07-49-57](https://us1.discourse-cdn.com/elastic/original/3X/b/f/bf7eb6bea9ed9baa3eb4f7d8162bfa9d60471a96.png)

---

<div class="post-metadata">

**Author:** ![Marinho\_DevOPs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marinho_devops/32/45572_2.png) [@Marinho\_DevOPs](https://discuss.elastic.co/u/Marinho_DevOPs)\
**Post date:** [January 8, 2020, 10:55am UTC](https://discuss.elastic.co/t/how-to-configure-nfs-in-eck-k8s-rancher/213936/8 "2020-01-08T10:55:04Z")

</div>

@sebgl and @Anya_Sabo

When I am trying to start the Elasticsearch master and date cluster I get the unbound persistentvolumeclaims error. How do i get pvc in the same pods as elasticsearch eck k8s. He functional in hospath normally when i create nfs he give me unbound persistentvolumeclaims error. Is it possible to have us claimName on the same pod?

---

<div class="post-metadata">

**Author:** ![sebgl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sebgl/32/48702_2.png) [@sebgl](https://discuss.elastic.co/u/sebgl)\
**Post date:** [January 8, 2020, 3:50pm UTC](https://discuss.elastic.co/t/how-to-configure-nfs-in-eck-k8s-rancher/213936/9 "2020-01-08T15:50:14Z")

</div>

- Unless you have a good reason to do so (like no volume provisioner), you should probably not define PersistentVolumeClaims and mount them in the spec yourself. Instead, you can just declare the claim template. ECK and the StatefulSet controller will take care of creating the PersistentVolumeClaim based on that template automatically. See [this doc](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-volume-claim-templates.html).

- You don't have to set `discovery.zen.ping.unicast.hosts`, `discovery.zen.minimum_master_nodes` and `node.name`. ECK is already doing that for you.

---

<div class="post-metadata">

**Author:** ![Marinho\_DevOPs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marinho_devops/32/45572_2.png) [@Marinho\_DevOPs](https://discuss.elastic.co/u/Marinho_DevOPs)\
**Post date:** [January 8, 2020, 4:56pm UTC](https://discuss.elastic.co/t/how-to-configure-nfs-in-eck-k8s-rancher/213936/10 "2020-01-08T16:56:13Z")

</div>

@sebgl thank you for informtion.  
But is possible to enable nfs to ECK

---

<div class="post-metadata">

**Author:** ![sebgl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sebgl/32/48702_2.png) [@sebgl](https://discuss.elastic.co/u/sebgl)\
**Post date:** [January 10, 2020, 3:06pm UTC](https://discuss.elastic.co/t/how-to-configure-nfs-in-eck-k8s-rancher/213936/11 "2020-01-10T15:06:22Z")

</div>

ECK is compatible with any PersistentVolume provider implementation.  
If you don't have a dynamic provisioner for NFS volumes, you should be able to manually create your own PersistentVolumes with an NFS spec. [This video](https://www.youtube.com/watch?v=to14wmNmRCI) gives an example.

However, we **strongly** recommend you not to use NFS with Elasticsearch. It usually leads to bad performance.

---

<div class="post-metadata">

**Author:** ![Mahmut\_Bilgen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mahmut_bilgen/32/72780_2.png) [@Mahmut\_Bilgen](https://discuss.elastic.co/u/Mahmut_Bilgen)\
**Post date:** [August 7, 2020, 3:40pm UTC](https://discuss.elastic.co/t/how-to-configure-nfs-in-eck-k8s-rancher/213936/12 "2020-08-07T15:40:43Z")

</div>

> [@sebgl](#):
>
> However, we **strongly** recommend you not to use NFS with Elasticsearch. It usually leads to bad performance

Hi,  
Is it suggested that using a trident **NetApp provisioner** instead of Local-disk or NFS share ? What do you suggest for on-premise provisioner?

Thanks in advance for your help.  
-Mahoni

---

<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:39am UTC](https://discuss.elastic.co/t/how-to-configure-nfs-in-eck-k8s-rancher/213936/13 "2022-11-04T07:39:33Z")

</div>


