I'm using ConfigMap
to expose a php file intended to be shared across pods and writable by the www-data
(Apache) user.
ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
name: magento-config
data:
env.php: |
<?php
return array ( ...
Deployment
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: apache-deployment
spec:
...
spec:
containers:
- name: apache
image: apache:2.4
...
volumeMounts:
- name: magento-configs
mountPath: /var/www/html/etc
imagePullPolicy: Always
volumes:
- name: magento-configs
configMap:
name: magento-config
The file appears writable only by root
though
root@apache-deployment-79c8548cdc-r6qhs:/# realpath /var/www/html/etc/env.php
/var/www/html/etc/..2018_04_23_16_21_10.435323593/env.php
root@apache-deployment-79c8548cdc-r6qhs:/# ls -l /var/www/html/etc/..2018_04_23_16_21_10.435323593/env.php
-rw-r--r-- 1 root root 909 Apr 23 16:21
Is there any way to change this? I noticed VolumeMount
has a readOnly
property which defaults to false
. Indeed the volume is writable, but only by root
.
I tried setting APACHE_RUN_USER
to root
in Apache, but it wants me to recompile (currently using build from apt) lol, which feels like the wrong direction. I'd like to just figure out how to use ConfigMap
correctly if possible.