with kubernetes config files

This commit is contained in:
Mosiur
2026-05-03 07:59:17 +00:00
commit 3e5fb66bd6
45 changed files with 423 additions and 0 deletions

77
backend/deployment.yaml Normal file
View File

@@ -0,0 +1,77 @@
# kubernetes/backend/backend.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: backend
namespace: todo-app
spec:
replicas: 2
selector:
matchLabels:
app: backend
template:
metadata:
labels:
app: backend
tier: api # ← label for NetworkPolicy
spec:
containers:
- name: backend
image: silvarno/todo-backend:latest
ports:
- containerPort: 5000
env:
- name: PORT
value: "5000"
- name: NODE_ENV
value: "production"
- name: MONGO_URI
valueFrom:
secretKeyRef:
name: todo-secrets
key: MONGO_URI
- name: JWT_SECRET
valueFrom:
secretKeyRef:
name: todo-secrets
key: JWT_SECRET
# Security context
securityContext:
runAsNonRoot: true
runAsUser: 1000
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
# Health checks
livenessProbe:
httpGet:
path: /health
port: 5000
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /health
port: 5000
initialDelaySeconds: 5
periodSeconds: 10
# Resource limits
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "256Mi"
cpu: "500m"
---
apiVersion: v1
kind: Service
metadata:
name: backend-service
namespace: todo-app
spec:
selector:
app: backend
ports:
- port: 5000
targetPort: 5000
type: ClusterIP # ← internal only