Redis¶
Single-instance Redis per environment, deployed from the Bitnami Helm chart through Argo CD's multi-source pattern. Used by the Tomoda backend for the Asynq job queues, sessions, rate limits and short-lived caches; not a store of record.
Argo CD Application¶
k8s/envs/<env>/redis/application.yaml declares two sources:
- Chart:
registry-1.docker.io/bitnamicharts/redisat chart version28.3.1. - Values: the same
devopsGit repo, referenced as$values, pointing atk8s/envs/<env>/redis/values.yaml.
The split lets the chart upgrade independently of the values file. Both envs sync into the data namespace.
Values (both envs)¶
image:
registry: docker.io
repository: bitnami/redis
tag: latest
digest: "sha256:33dbb7a4…" # redis 8.10.2
architecture: standalone
replicaCount: 1
auth:
enabled: true
sentinel: false
existingSecret: redis-<env>-password-secret
existingSecretPasswordKey: redis-password
The image tracks the maintained bitnami/redis (not the frozen bitnamilegacy/* namespace) and pins the digest for reproducibility. Bitnami's free tier publishes only the latest tag, so the digest is the version pin: re-pin it from bitnami/redis:latest to pick up newer CVE fixes, and check the image's org.opencontainers.image.version label first, since latest can move to a new Redis major. The exporter sidecar (bitnami/redis-exporter) is digest-pinned the same way under metrics.image.digest. standalone is a single Redis pod, no failover (lean): the data is recoverable (no source-of-truth state) and the restart blast radius is small.
Node placement¶
No node selectors; both envs run on the server alongside everything else, on local-path storage.
HA switch (resilient flavour)¶
Lean is architecture: standalone, one pod. The resilient upgrade switches to Sentinel: architecture: replication + sentinel.enabled: true, giving 1 master + 2 replicas + 3 sentinels for automatic failover. Applications keep connecting through the Sentinel-aware Service; the DSN changes but the REDIS_* env contract does not. Turn this on together with the Postgres HA switch when a second server joins.
Auth¶
auth.enabled: true in both envs; Redis requires a password on every connection. The chart reads it from an existing Secret: auth.existingSecret: redis-<env>-password-secret, auth.existingSecretPasswordKey: redis-password (k8s/envs/{dev,prod}/redis/values.yaml).
That Secret is projected by an ExternalSecret (k8s/envs/{dev,prod}/redis/external-secret.yaml) from the per-env GCP Secret Manager key tomoda-redis-password-<env> into redis-password. The backend reads the same value as REDIS_PASSWORD, so pod and clients stay in sync.
Network reach is constrained independently: the Redis Service is reachable only inside the data namespace, gated by consumer-side NetworkPolicies and the absence of any Ingress or LoadBalancer.
Persistence¶
| Env | PVC size | Notes |
|---|---|---|
| dev | 1Gi |
RDB/AOF snapshots survive pod restart |
| prod | 10Gi |
Larger room for prod working set |
Both use the cluster default StorageClass.
Resources¶
| Env | Requests | Limits | maxmemory |
|---|---|---|---|
| dev | 25m CPU, 64Mi memory | 256Mi memory | 200mb |
| prod | 50m CPU, 256Mi memory | 2Gi memory | 1600mb |
maxmemory sits below the container limit with maxmemory-policy noeviction: at the cap Redis rejects writes (the backend sees errors) instead of being OOMKilled, and queued jobs are never evicted. RedisMemoryNearMax warns at 80% of maxmemory, RedisHighMemory fires at 90%, RedisRejectingWrites on the first rejected write, and RedisMaxmemoryUnset if the cap is ever 0.
Metrics¶
Both envs set metrics.enabled: true, running the Redis exporter sidecar and registering a ServiceMonitor in monitoring under release: monitoring, which kube-prometheus-stack picks up automatically. Every Redis alert (k8s/envs/platform/manifests/redis-alerts.yaml, Data alert runbook) reads these series by job, redis-<env>-metrics.
DSNs (application-facing)¶
The Bitnami chart names its Service <release>-master. Applications connect to:
| Env | Hostname | Port |
|---|---|---|
| dev | redis-dev-master.data.svc.cluster.local |
6379 |
| prod | redis-prod-master.data.svc.cluster.local |
6379 |
These hostnames are written into the Tomoda backend-config-<env> ConfigMap. The prod release is redis-prod (application.yaml metadata), so redis-prod-master is the rendered Service name.
Operations¶
- Bounce:
kubectl -n data rollout restart statefulset/<release>-master. Witharchitecture: standalonethere is no quorum to worry about; persistence survives the restart. - Console: use Redis Insight for a GUI, or
kubectl -n data exec -it <release>-master-0 -- redis-clifor ad-hoc commands. - Storage:
local-pathdoesn't enforce sizes; Redis can use the server's free disk. Watch host disk instead. - Chart upgrade: change
targetRevisionon the chart source. Review the chart release notes; values keys drift between major versions.