WP-14(Terraform 설계서 7.3, 실험·앱 설계서 3.1·4.3). - apps/ingress-nginx: baremetal 매니페스트(controller-v1.15.1)를 kustomize로 가져와 NodePort 30080/30443 고정(ALB TG와 일치). - apps/demo-app + workloads/demo-app: front(nginx-unprivileged 1.31.6, 정적 페이지 + /api/ 프록시) 2, api(demo-api:8f5378b) 3 + PDB minAvailable 2, Service, Ingress(/ front, /api api). DB_DSN은 Secret demo-db(make k8s-secrets로 생성, git 밖). - apps/chaos-mesh: Helm chart 2.8.4(containerd 소켓, dashboard 없음). - vm/observability/grafana/provisioning/alerting: contact point harness-webhook (10.20.0.11:8080/hooks/alert), 루트 정책, 규칙 8건(ProbeDown·ApiLatencyHigh· ApiErrorRateHigh·PodCrashLooping·LegacyUnhealthy·DbReplicationLag·DbPrimaryDown· GitOpsDrift, 라벨 layer/signature).
66 lines
2.2 KiB
YAML
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) -> VPN -> 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/readyz">/api/readyz</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 }]
|