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