Deployment com liveness probe para detectar quando a app trava e reiniciar o container automaticamente.
42 lines
1.1 KiB
YAML
42 lines
1.1 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: node-bugado
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: node-bugado
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: node-bugado
|
|
spec:
|
|
terminationGracePeriodSeconds: 5
|
|
containers:
|
|
- name: app
|
|
image: node:24-alpine
|
|
command: ["node", "/app/app.js"]
|
|
env:
|
|
- name: MAX_REQUESTS
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: app-config
|
|
key: MAX_REQUESTS
|
|
ports:
|
|
- containerPort: 3000
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /health
|
|
port: 3000
|
|
initialDelaySeconds: 5 # Espera para começar a testar
|
|
periodSeconds: 2 # A cada 5 segs faz o teste novamente
|
|
failureThreshold: 2 # Vezes seguidas antes de ser considerado morto
|
|
volumeMounts:
|
|
- name: app-volume
|
|
mountPath: /app
|
|
volumes:
|
|
- name: app-volume
|
|
configMap:
|
|
name: app-config
|