Files
selfheal-lab-gitops/workloads/demo-app/front.yaml
T
seon de52d4a1ec fix: run ingress-nginx admission jobs as Argo CD sync hooks; fix front links
- ingress-nginx admission Job 2개는 ttlSecondsAfterFinished: 0으로 완료 즉시 사라져
  Argo CD가 영구 OutOfSync로 보고 selfHeal 때마다 다시 실행했다(2026-09-24 실측).
  Sync 훅(HookSucceeded 삭제)으로 돌린다.
- front 정적 페이지의 /api/readyz 링크(404)를 제거한다(api의 /readyz는 /api 아래가 아님).
2026-09-24 01:46:17 +09:00

66 lines
2.2 KiB
YAML

# front: nginx (unprivileged) serving a static page and proxying /api/ to the api Service.
apiVersion: v1
kind: ConfigMap
metadata:
name: front-nginx
namespace: demo
data:
default.conf: |
server {
listen 8080;
server_name _;
location = /healthz { add_header Content-Type text/plain; return 200 'ok'; }
location /api/ {
proxy_pass http://api:8080/api/;
proxy_connect_timeout 2s;
proxy_read_timeout 5s;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location / { root /usr/share/nginx/html; index index.html; }
}
index.html: |
<!doctype html><html lang="ja"><meta charset="utf-8"><title>selfheal demo</title>
<body style="font-family:system-ui;margin:2rem"><h1>selfheal demo front</h1>
<p>container layer (AWS k8s) -&gt; VPN -&gt; VM layer (GCP legacy-api, PostgreSQL)</p>
<ul><li><a href="/api/orders">/api/orders</a></li><li><a href="/api/price/apple">/api/price/apple</a></li><li><a href="/api/price/nothere">/api/price/nothere (404)</a></li></ul>
</body></html>
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: front
namespace: demo
labels: { app: front }
spec:
replicas: 2
selector:
matchLabels: { app: front }
template:
metadata:
labels: { app: front }
spec:
containers:
- name: nginx
image: nginxinc/nginx-unprivileged:1.31.6-alpine
ports: [{ name: http, containerPort: 8080 }]
volumeMounts:
- { name: conf, mountPath: /etc/nginx/conf.d/default.conf, subPath: default.conf, readOnly: true }
- { name: conf, mountPath: /usr/share/nginx/html/index.html, subPath: index.html, readOnly: true }
livenessProbe: { httpGet: { path: /healthz, port: http }, periodSeconds: 10, failureThreshold: 3 }
readinessProbe: { httpGet: { path: /healthz, port: http }, periodSeconds: 5, failureThreshold: 2 }
resources:
requests: { cpu: 50m, memory: 32Mi }
limits: { memory: 64Mi }
volumes:
- name: conf
configMap: { name: front-nginx }
---
apiVersion: v1
kind: Service
metadata:
name: front
namespace: demo
spec:
selector: { app: front }
ports: [{ name: http, port: 8080, targetPort: http }]