From 9c16c9d99b9d7c0dae25bfb0cb59eea994fd85b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beatrice=20Dellac=C3=A0?= Date: Sun, 30 Mar 2025 14:28:40 +0200 Subject: [PATCH] fix read only fs? --- deploy/redis/redis-sentinel-deploy.yaml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/deploy/redis/redis-sentinel-deploy.yaml b/deploy/redis/redis-sentinel-deploy.yaml index d034ddc..3f6578f 100644 --- a/deploy/redis/redis-sentinel-deploy.yaml +++ b/deploy/redis/redis-sentinel-deploy.yaml @@ -15,6 +15,16 @@ spec: labels: app: redis-sentinel spec: + # Init container to copy the sentinel.conf from the ConfigMap to a writable emptyDir volume. + initContainers: + - name: copy-sentinel-config + image: busybox + command: ['sh', '-c', 'cp /config/sentinel.conf /writable/'] + volumeMounts: + - name: sentinel-config-readonly + mountPath: /config + - name: sentinel-config + mountPath: /writable containers: - name: redis-sentinel image: redis:6.2-alpine @@ -26,8 +36,12 @@ spec: - "/etc/redis/sentinel.conf" volumeMounts: - name: sentinel-config - mountPath: /etc/redis + mountPath: /etc/redis # this volume is now writable volumes: - - name: sentinel-config + # Mount the ConfigMap as a read-only volume for the init container + - name: sentinel-config-readonly configMap: name: redis-sentinel-config + # EmptyDir volume to hold the writable config file + - name: sentinel-config + emptyDir: {}