71 lines
1.6 KiB
YAML
71 lines
1.6 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: devops-app
|
|
namespace: devops-demo
|
|
labels:
|
|
app: devops-app
|
|
version: v1
|
|
spec:
|
|
replicas: 2
|
|
selector:
|
|
matchLabels:
|
|
app: devops-app
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: devops-app
|
|
annotations:
|
|
prometheus.io/scrape: "true"
|
|
prometheus.io/port: "8000"
|
|
prometheus.io/path: "/metrics"
|
|
spec:
|
|
containers:
|
|
- name: app
|
|
image: devops-app:local # IMPORTANT : Utiliser l'image locale
|
|
imagePullPolicy: IfNotPresent # Ne pas pull depuis Docker Hub
|
|
ports:
|
|
- containerPort: 8000
|
|
name: http
|
|
envFrom:
|
|
- configMapRef:
|
|
name: app-config
|
|
env:
|
|
- name: HOSTNAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
resources:
|
|
requests:
|
|
memory: "128Mi"
|
|
cpu: "100m"
|
|
limits:
|
|
memory: "256Mi"
|
|
cpu: "200m"
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /health
|
|
port: 8000
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 15
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /health
|
|
port: 8000
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 30
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: devops-app-service
|
|
namespace: devops-demo
|
|
spec:
|
|
selector:
|
|
app: devops-app
|
|
ports:
|
|
- port: 80
|
|
targetPort: 8000
|
|
protocol: TCP
|
|
name: http
|
|
type: NodePort # CORRIGÉ : NodePort au lieu de LoadBalancer pour Windows |