fix read only fs?

This commit is contained in:
2025-03-30 14:28:40 +02:00
parent b343bfe0d9
commit 9c16c9d99b

View File

@@ -15,6 +15,16 @@ spec:
labels: labels:
app: redis-sentinel app: redis-sentinel
spec: 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: containers:
- name: redis-sentinel - name: redis-sentinel
image: redis:6.2-alpine image: redis:6.2-alpine
@@ -26,8 +36,12 @@ spec:
- "/etc/redis/sentinel.conf" - "/etc/redis/sentinel.conf"
volumeMounts: volumeMounts:
- name: sentinel-config - name: sentinel-config
mountPath: /etc/redis mountPath: /etc/redis # this volume is now writable
volumes: volumes:
- name: sentinel-config # Mount the ConfigMap as a read-only volume for the init container
- name: sentinel-config-readonly
configMap: configMap:
name: redis-sentinel-config name: redis-sentinel-config
# EmptyDir volume to hold the writable config file
- name: sentinel-config
emptyDir: {}