feat: Add complete Redis cache example with multi-container pod and web interface

This commit is contained in:
mik-tf
2025-11-04 13:51:39 -05:00
parent 1a902b3178
commit 5a29153a84
6 changed files with 1090 additions and 2 deletions

View File

@@ -0,0 +1,57 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-cache
spec:
replicas: 1
selector:
matchLabels:
app: redis-cache
template:
metadata:
labels:
app: redis-cache
spec:
containers:
- name: redis-cache
image: redis:7-alpine
ports:
- containerPort: 6379
name: redis
command: ["redis-server"]
args: ["--bind", "0.0.0.0", "--protected-mode", "no", "--maxmemory", "64mb", "--maxmemory-policy", "allkeys-lru"]
env:
- name: REDIS_PASSWORD
value: ""
resources:
requests:
memory: "32Mi"
cpu: "100m"
limits:
memory: "64Mi"
cpu: "200m"
- name: redis-web-interface
image: python:3.11-alpine
ports:
- containerPort: 8080
name: web
command: ["/bin/sh", "-c"]
args:
- |
pip install flask redis &&
python /app/web-interface.py
volumeMounts:
- name: web-interface
mountPath: /app
resources:
requests:
memory: "16Mi"
cpu: "50m"
limits:
memory: "32Mi"
cpu: "100m"
volumes:
- name: web-interface
configMap:
name: redis-web-interface