zkt26/z2/deployment.yaml

119 lines
2.9 KiB
YAML

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: icebay-web
namespace: icebay
labels:
app: icebay
component: web
spec:
replicas: 2
selector:
matchLabels:
app: icebay
component: web
template:
metadata:
labels:
app: icebay
component: web
spec:
initContainers:
- name: wait-for-db
image: busybox:1.36
command: [sh,-c,"until nc -z postgres-service 5432; do sleep 2; done"]
- name: wait-for-redis
image: busybox:1.36
command: [sh,-c,"until nc -z redis-service 6379; do sleep 2; done"]
containers:
- name: icebay-web
image: icebay-web:latest
imagePullPolicy: Never
ports:
- containerPort: 5000
env:
- name: DB_HOST
value: "postgres-service"
- name: DB_PORT
value: "5432"
- name: DB_NAME
value: "icebaydb"
- name: DB_USER
valueFrom:
secretKeyRef:
name: icebay-secret
key: POSTGRES_USER
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: icebay-secret
key: POSTGRES_PASSWORD
- name: REDIS_HOST
value: "redis-service"
- name: REDIS_PORT
value: "6379"
- name: SECRET_KEY
valueFrom:
secretKeyRef:
name: icebay-secret
key: SECRET_KEY
readinessProbe:
httpGet:
path: /health
port: 5000
initialDelaySeconds: 10
periodSeconds: 5
livenessProbe:
httpGet:
path: /health
port: 5000
initialDelaySeconds: 20
periodSeconds: 10
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "256Mi"
cpu: "300m"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
namespace: icebay
labels:
app: icebay
component: cache
spec:
replicas: 1
selector:
matchLabels:
app: icebay
component: cache
template:
metadata:
labels:
app: icebay
component: cache
spec:
containers:
- name: redis
image: redis:7-alpine
ports:
- containerPort: 6379
command: ["redis-server","--maxmemory","64mb","--maxmemory-policy","allkeys-lru"]
readinessProbe:
exec:
command: ["redis-cli","ping"]
initialDelaySeconds: 5
periodSeconds: 5
resources:
requests:
memory: "64Mi"
cpu: "50m"
limits:
memory: "128Mi"
cpu: "100m"