Add k8s/base/ directory with Kustomize manifests for deploying the scrum-manager application to Kubernetes: - Namespace (scrum-manager) - MySQL: Deployment, Service, PVC, Secret - Backend: Deployment (2 replicas) with init container, Service - Frontend: Deployment (2 replicas), Service (NodePort), ConfigMap (nginx.conf) All deployments include resource requests/limits, liveness/readiness probes, and proper label selectors.
85 lines
2.2 KiB
YAML
85 lines
2.2 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: backend
|
|
labels:
|
|
app.kubernetes.io/name: backend
|
|
app.kubernetes.io/component: api
|
|
spec:
|
|
replicas: 2
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: backend
|
|
app.kubernetes.io/component: api
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: backend
|
|
app.kubernetes.io/component: api
|
|
spec:
|
|
initContainers:
|
|
- name: wait-for-mysql
|
|
image: busybox:1.36
|
|
command:
|
|
- sh
|
|
- -c
|
|
- |
|
|
echo "Waiting for MySQL to be ready..."
|
|
until nc -z mysql 3306; do
|
|
echo "MySQL is not ready yet, retrying in 3s..."
|
|
sleep 3
|
|
done
|
|
echo "MySQL is ready!"
|
|
containers:
|
|
- name: backend
|
|
image: scrum-backend:latest
|
|
imagePullPolicy: IfNotPresent
|
|
ports:
|
|
- containerPort: 3001
|
|
name: http
|
|
env:
|
|
- name: DB_HOST
|
|
value: mysql
|
|
- name: DB_PORT
|
|
value: "3306"
|
|
- name: DB_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: mysql-secret
|
|
key: DB_USER
|
|
- name: DB_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: mysql-secret
|
|
key: DB_PASSWORD
|
|
- name: DB_NAME
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: mysql-secret
|
|
key: DB_NAME
|
|
- name: PORT
|
|
value: "3001"
|
|
resources:
|
|
requests:
|
|
cpu: 100m
|
|
memory: 128Mi
|
|
limits:
|
|
cpu: 500m
|
|
memory: 256Mi
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /api/health
|
|
port: http
|
|
initialDelaySeconds: 15
|
|
periodSeconds: 10
|
|
timeoutSeconds: 3
|
|
failureThreshold: 3
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /api/health
|
|
port: http
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 5
|
|
timeoutSeconds: 3
|
|
failureThreshold: 5
|