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).
- 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:
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:
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:
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.