Hi All,
Below is the issue im getting in kubectl
i have deploy 3 pods in gcloud kubernetes
All 3 are getting same issue of read-only file system
Container image "elasticsearch:6.8.12" already present on machine
Warning Failed 2m29s (x2 over 2m42s) kubelet (combined from similar events): Error: failed to generate container "d9e84805ac3f59db8209b63121aa43e271c31e49cd3dbc589ea9fd28fcb7a033" spec: failed to generate spec: failed to mkdir "/elasticsearch/esdata": mkdir /elasticsearch: read-only file system
Here is the elasticsearch-data.yml file
apiVersion: apps/v1
kind: Deployment
metadata:
name: fx-elasticsearch
spec:
replicas: 1
selector:
matchLabels:
app: fx-elasticsearch
template:
metadata:
labels:
app: fx-elasticsearch
spec:
initContainers:
- name: init-sysctl
image: busybox:1.27.2
command:
- sysctl
- -w
- vm.max_map_count=262144
securityContext:
privileged: true
# nodeName: aks-agentpool-12700391-0
containers:
- name: fx-elasticsearch
image: elasticsearch:6.8.12
ports:
- containerPort: 9200
envFrom:
- configMapRef:
name: elastic-config
# volumeMounts:
# - mountPath: "/usr/share/elasticsearch/data"
# name: elasticsearch-pvc-storage
# subPath: elasticsearch
# - mountPath: "/usr/share/elasticsearch/config/elasticsearch.yml"
# subPath: elasticsearch.yml
# name: elasticsearch-configfile
# volumes:
# - name: elasticsearch-pvc-storage
# persistentVolumeClaim:
# claimName: elasticsearch-azure-disk-pvc
# - name: elasticsearch-configfile
# configMap:
# name: elasticsearch-config
#
volumeMounts:
- mountPath: "/usr/share/elasticsearch/data"
name: elasticsearch-pv-storageclaim
- mountPath: "/usr/share/elasticsearch/config/elasticsearch.yml"
subPath: elasticsearch.yml
name: elasticsearch-configfile
volumes:
- name: elasticsearch-pv-storageclaim
persistentVolumeClaim:
claimName: elasticsearch-pv-claim
- name: elasticsearch-configfile
configMap:
name: elasticsearch-config
### For HostPath Volume Type
# volumeMounts:
# - mountPath: "/usr/share/elasticsearch/config/elasticsearch.yml"
# subPath: elasticsearch.yml
# name: elasticsearch-configfile
# - mountPath: "/usr/share/elasticsearch/data"
# name: "esdata"
# volumes:
# - name: elasticsearch-configfile
# configMap:
# name: elasticsearch-config
# - hostPath:
# path: "/elasticsearch/esdata"
# name: cloud-esdata
---
apiVersion: v1
kind: Service
metadata:
name: fx-elasticsearch
labels:
app: fx-elasticsearch
spec:
type: NodePort
# type: ClusterIP
ports:
- port: 9200
selector:
app: fx-elasticsearch
ports:
- port: 9200
name: fx-elasticsearch
- port: 9300
name: transport
Here is my elasticsearch-pv-claim.yaml file
apiVersion: v1
kind: PersistentVolume
metadata:
name: elasticsearch-pv
labels:
type: local
spec:
storageClassName: standard
capacity:
storage: 10G
accessModes:
- ReadWriteOnce
hostPath:
path: "/elasticsearch/esdata"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: elasticsearch
name: elasticsearch-pv-claim
spec:
storageClassName: standard
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10G
All this deploy in gcp kubernets cluster
please help me