Alexis Bruneteau 3853e97ddf
Some checks failed
Build and Deploy to k3s (Production) / build-and-deploy (push) Failing after 3m11s
fix(k8s): correct port configuration for Next.js 3000 port
Fix 502 Bad Gateway error - application was configured to listen on port 80
but Dockerfile specifies port 3000 for Next.js.

Changes:
- Updated deployment.yml: containerPort 80 → 3000 (both prod & alpha)
- Updated service.yml: targetPort 80 → 3000 (both prod & alpha)
- Added image registry suffix: hosting-frontend → hosting-frontend-prod/alpha
- Added environment variable: NEXT_PUBLIC_API_URL
- Added health checks: livenessProbe and readinessProbe
- Added protocol: TCP explicit declaration

Benefits:
- Fixes 502 Bad Gateway errors from Cloudflare
- Proper port mapping: Ingress 80 → Service 80 → Pod 3000
- Health checks enable Kubernetes to detect pod issues
- Environment variables passed at deployment time

Deployment Flow:
  Client → Cloudflare → Ingress (traefik:80) → Service (port:80) → Pod (3000)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-17 01:16:34 +02:00

39 lines
856 B
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: hosting-frontend
namespace: hosting
spec:
replicas: 1
selector:
matchLabels:
app: hosting-frontend
template:
metadata:
labels:
app: hosting-frontend
spec:
containers:
- name: hosting-frontend
image: gitea.vidoks.fr/sortifal/hosting-frontend-prod:latest
ports:
- containerPort: 3000
env:
- name: NEXT_PUBLIC_API_URL
value: "https://api.portfolio-host.com/api"
livenessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 10
periodSeconds: 10
readinessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 5
periodSeconds: 5