Error config Map volume mount read-only file system error

0 votes

I have a configmap for 3 files that are going to be mounted in  "fluentd/etc/" and the respective files are fluent.conf, Kubernetes.conf, systemd.conf, configmap in deployment.yaml is like this:

volumeMounts:
name: fluentd
mountPath: /fluentd/etc/
name: varlog
mountPath: /var/log
name: container1
mountPath: /var/lib/docker/containers
readOnly: true
securityContext:
privileged: true
terminationGracePeriodSeconds: 30
volumes:
name: varlog
hostPath:
path: /var/log
name: container1
hostPath:
path: /var/lib/docker/containers
name: fluentd
configMap:
name: fluentd-config

During deployment I am getting an error of mount as read-only, which is effecting fluent to read some of the mentioned sources in the configmap. How can I avoid this read-only error?

Jul 18, 2019 in Kubernetes by Karan
• 19,610 points
20,926 views

1 answer to this question.

+1 vote

ConfigMaps are always mounted read-only.

If you need to modify a configmap in a pod, you should copy it from the configmap mount to a regular file in the pod and then modify it. 

To solve this issue :

  • you should use an init container to mount the configmap

  • copy the configmap into an `emptyDir` volume and

  • share the volume with the main container.

  • configmaps are mounted read-only so that you can't touch the files. 

  • when the master configmap changes the mounted file also changes. so if you were to modify the local mounted file, it would be overwritten anyways.

answered Jul 18, 2019 by Sirajul
• 59,230 points

Related Questions In Kubernetes

0 votes
1 answer

Set volume mount user group and file permissions in kubernetes

There's a setting in Pod Security Context ...READ MORE

answered Jan 16, 2019 in Kubernetes by ajs3033
• 7,300 points
27,959 views
0 votes
1 answer

config-map kubernetes multiple environments

Deploy your application as helm chart.  After having ...READ MORE

answered Aug 31, 2018 in Kubernetes by Kalgi
• 52,350 points
2,075 views
0 votes
1 answer

ConfigMaps volume not creating file in container

Did a little research and found the ...READ MORE

answered Sep 6, 2018 in Kubernetes by Atul
• 10,240 points
1,189 views
0 votes
1 answer
+1 vote
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17, 2019 in Others by anonymous
15,476 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,035 views
+1 vote
1 answer

Can pods mount NFS volume?

Yes, there's an example here of both ...READ MORE

answered Jul 15, 2019 in Kubernetes by Sirajul
• 59,230 points
3,385 views
0 votes
1 answer

What is the difference between config map and secret in kubernetes?

Config maps ideally stores application configuration in ...READ MORE

answered Jul 17, 2019 in Kubernetes by Sirajul
• 59,230 points
3,729 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP