kubernetes
Redis Kubernetes Memory Calculator
Calculate how much memory your Redis deployment needs on Kubernetes. Accounts for dataset size, replication, overhead, and Redis Cluster mode.
Sizing Redis on Kubernetes
Redis is an in-memory data store — all data lives in RAM. Correct memory sizing is critical: too little triggers OOM kills; too much wastes compute cost.
Memory Formula
per_replica_memory = dataset_size × (1 + overhead_pct)
total_memory = per_replica_memory × replicas × cluster_factorWhere cluster_factor = 1.1 for Redis Cluster, 1.0 for standalone.
Key Redis Memory Patterns
| Use Case | Overhead | Eviction Policy |
|---|---|---|
| Cache (ephemeral) | 20–30% | allkeys-lru |
| Session store | 30–50% | noeviction |
| Pub/Sub broker | 20% | noeviction |
| Sorted sets / leaderboards | 50–100% | volatile-lru |
Kubernetes Pod Configuration
resources:
requests:
memory: "8Gi" # from calculator
limits:
memory: "10Gi" # 1.2× request
env:
- name: REDIS_ARGS
value: "--maxmemory 8192mb --maxmemory-policy allkeys-lru"Redis Sentinel vs Redis Cluster
| Sentinel | Cluster | |
|---|---|---|
| Sharding | No — single dataset | Yes — hash slots |
| Failover | Automatic | Automatic |
| Max dataset | Single node RAM | N × node RAM |
| Complexity | Low | High |
| K8s operator | redis-operator | redis-operator (cluster mode) |
Key Terms
Full glossary →kubeadm
A tool for bootstrapping Kubernetes clusters. It automates the setup of control plane components and joining worker nodes, following Kubernetes best practices.
etcd
A distributed key-value store used by Kubernetes to store all cluster state and configuration. etcd is the single source of truth for the entire cluster.
cert-manager
A Kubernetes controller for automating TLS certificate management. cert-manager can issue certificates from Let's Encrypt, Vault, or internal CAs, and automatically renews them.
Helm
A package manager for Kubernetes. Helm charts bundle Kubernetes manifests into reusable packages with configurable values, versioned and published to chart repositories.
Frequently Asked Questions
Why does Redis use more memory than my raw data size?
Redis stores each value with metadata — key expiry, type information, encoding, and a pointer. A string 'hello' (5 bytes) might occupy 60–80 bytes in Redis memory. For datasets with many small keys, overhead can be 30–100% of raw data size. Use OBJECT ENCODING <key> to inspect how Redis is storing individual values.
How do I set maxmemory in a Kubernetes Pod?
Set maxmemory in redis.conf or pass it as a flag: redis-server --maxmemory 8gb --maxmemory-policy allkeys-lru. Always set maxmemory to ~80% of your container memory limit — this leaves headroom for the Redis process itself and prevents OOM kills. The calculator's maxmemory output already accounts for this.
Do Redis replicas double my memory usage?
Yes — each replica holds a full copy of the dataset. 3 replicas (1 primary + 2 replicas) triple your memory usage. The tradeoff is high availability: replicas allow failover without data loss if the primary crashes. For pure caching where data loss is acceptable, replicas are optional.
What is Redis Cluster mode and when do I need it?
Redis Cluster shards data across multiple primary nodes using hash slots. It's needed when your dataset is too large for a single node, or when you need horizontal write scalability. For most use cases under ~50GB, a single primary with replicas (Sentinel) is simpler and sufficient. Redis Cluster adds operational complexity and does not support all Redis commands.
Related Tools
K8s Node Sizing
Calculate the right number and size of Kubernetes worker nodes for your workloads. Supports Hetzner Cloud and Vultr with verified pricing.
Longhorn Storage
Calculate the total storage required for Longhorn distributed block storage, including replica overhead, snapshot retention, and S3 backup sizing on Hetzner Object Storage.
Resource Quota
Calculate namespace ResourceQuota values for your Kubernetes cluster. Set CPU and memory limits per namespace based on team size, pod count, and a safety buffer.
Related Guides
kubernetes
CI/CD for Kubernetes with GitHub Actions: A Complete Guide (2026)
A practical walkthrough of building a full GitHub Actions pipeline that builds a container image, pushes it to a registry, and deploys to Kubernetes — with secrets handling, rollback, and Helm support.
kubernetes
ArgoCD vs Flux: Choosing a GitOps Tool for Kubernetes in 2026
A no-fluff comparison of ArgoCD and Flux for GitOps on Kubernetes — covering architecture, UI, Helm support, multi-tenancy, and when to pick each one.
kubernetes
Hetzner vs DigitalOcean for Kubernetes in 2026: An Honest Comparison
Hetzner is 3–5× cheaper than DigitalOcean for equivalent Kubernetes compute. But DO has managed K8s, better global coverage, and a larger app marketplace. Here's when each is the right choice.