Hi!
I'm trying to deploy Elasticsearch 7.12.0 on Kubernetes and have configured it to run as a single-node cluster.
But after deployment, I encountered the following error:
Exception in thread "main" org.elasticsearch.bootstrap.BootstrapException: java.nio.file.FileSystemException: /usr/share/elasticsearch/config/elasticsearch.keystore.tmp: Read-only file system
Likely root cause: java.nio.file.FileSystemException: /usr/share/elasticsearch/config/elasticsearch.keystore.tmp: Read-only file system
Here are the relevant parts of my configurations:
Deployment YAML:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: elasticsearch
name: elasticsearch
spec:
replicas: 1
selector:
matchLabels:
app: elasticsearch
template:
metadata:
labels:
app: elasticsearch
spec:
containers:
- image: docker.elastic.co/elasticsearch/elasticsearch:7.12.0
name: elasticsearch
env:
- name: discovery.type
value: single-node
ports:
- containerPort: 9200
- containerPort: 9300
volumeMounts:
- mountPath: /usr/share/elasticsearch/config
name: elasticsearch-config
- mountPath: /usr/share/elasticsearch/data
name: elasticsearch-data
resources:
limits:
memory: 2Gi
cpu: "1"
requests:
memory: 1Gi
cpu: "1"
volumes:
- name: elasticsearch-config
configMap:
name: elasticsearch-config
- name: elasticsearch-data
persistentVolumeClaim:
claimName: elasticsearch
securityContext:
fsGroup: 1000
restartPolicy: Always
ConfigMap YAML:
apiVersion: v1
kind: ConfigMap
metadata:
name: elasticsearch-config
data:
elasticsearch.yml: |
cluster.name: "docker-cluster"
network.host: 0.0.0.0
path.data: /usr/share/elasticsearch/data
jvm.options: |
-Xms512m
-Xmx512m
PersistentVolumeClaim YAML:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: elasticsearch
name: elasticsearch
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
believe the issue might be related to how the volumes are mounted or permissions are set. How can I resolve this "Read-only file system" error for the Elasticsearch configuration in Kubernetes?