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: {}