redis / docker-library-redis

Docker Official Image packaging for Redis
http://redis.io
BSD 3-Clause "New" or "Revised" License
1.11k stars 560 forks source link

overcommit_memory for Kubernetes #399

Closed idan3 closed 1 month ago

idan3 commented 1 month ago

Redis recommends in the docs to set vm.overcommit_memory = 1. That's fine but what can I do when I run Redis on a Kubernetes pod? I do not want to enable it on the node because there are more pods running on this node. Is there a solution for that?

yosifkit commented 1 month ago

https://github.com/docker-library/redis/issues/298#issuecomment-972275132:

This value is not namespaced and so must be set on the host as the container cannot set it.

The only solution is to set it on the host.

idan3 commented 1 month ago

So is there a best practice for 'how to set Redis on Kubernetes cluster'?

tianon commented 1 month ago

Unfortunately, if you want to set this upstream-recommended setting you'll have to do it cluster-wide on your k8s host systems (the scope of doing that successfully is going to vary wildly across different ways of deploying k8s, so is not really something that could be documented in a "standard" way).