Search code examples
dockerredisopenshiftkubernetesredhat

OpenShift and persistent Redis config


I have successfully deployed Redis (persistent) image on my OpenShift installation. Now I want to persist the Redis configuration, and I have followed this instructions.

However, the Redis is started with this command inside a container: /opt/rh/rh-redis32/root/usr/bin/redis-server *:6379

I see that it should be started with the first argument as a path to the configuration file in order to configure itself on startup.

How can I achieve this in OpenShift?


Solution

  • I solved this issue with run commands specified in deployment config:

     containers:
            - name: redis
              image: >-
                centos/redis-32-centos7@sha256:7289ff47dd1c5bd24e6eefaf18cfbacf5ad68c0768f1b727a79c026bbef5a038
              command:
                - /opt/rh/rh-redis32/root/usr/bin/redis-server
                - /redis-master/redis.conf
    

    Since this completly overrides default startup behaviof of the provided Docker image I had to add dir and requirepass configs to my config map:

    dir /var/lib/redis/data
    requirepass srid
    maxmemory 2mb
    maxmemory-policy allkeys-lru