tarefas-app/k8s/app-deployment.yaml
2025-06-22 13:26:20 +00:00

90 lines
2.1 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: tarefas-api
namespace: tarefas-app
spec:
replicas: 2
selector:
matchLabels:
app: tarefas-api
template:
metadata:
labels:
app: tarefas-api
spec:
containers:
- name: tarefas-api
image: gitea.adnangonzagaci.com/adnangonzaga/tarefas-app/tarefas-api:latest
imagePullPolicy: Always
env:
- name: SPRING_DATASOURCE_URL
value: "jdbc:mysql://mysql:3306/tarefas_db?createDatabaseIfNotExist=true&useSSL=false&allowPublicKeyRetrieval=true"
- name: SPRING_DATASOURCE_USERNAME
value: "tarefas_user"
- name: SPRING_DATASOURCE_PASSWORD
value: "senha123"
- name: SPRING_JPA_HIBERNATE_DDL_AUTO
value: "update"
- name: SPRING_PROFILES_ACTIVE
value: "production"
ports:
- containerPort: 8080
livenessProbe:
httpGet:
path: /api/actuator/health
port: 8080
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /api/actuator/health
port: 8080
initialDelaySeconds: 30
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 3
resources:
limits:
memory: "1Gi"
cpu: "500m"
requests:
memory: "512Mi"
cpu: "250m"
---
apiVersion: v1
kind: Service
metadata:
name: tarefas-api
namespace: tarefas-app
spec:
selector:
app: tarefas-api
ports:
- port: 80
targetPort: 8080
type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: tarefas-api-ingress
namespace: tarefas-app
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: traefik
rules:
- host: tarefas.adnangonzaga.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: tarefas-api
port:
number: 80