feat: Add complete Redis cache example with multi-container pod and web interface
This commit is contained in:
57
examples/redis-cache/redis-cache-deployment.yaml
Normal file
57
examples/redis-cache/redis-cache-deployment.yaml
Normal 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
|
||||
Reference in New Issue
Block a user