Running memcached in kubernetes with all available memory by default.

Hardcoding the memory limit seems weird when we already define the limit via kubernetes limits … so making it just use everything available.

# Dockerfile
FROM memcached
CMD ["sh", ""]

exec memcached -m $(cat /sys/fs/cgroup/memory/memory.stat | 
grep hierarchical_memory_limit | 
awk '{print $2 / 1024 / 1024 - 10}')

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s