Files
awoooi/k8s/argocd/argocd-metrics-network-policy.yaml
OG T e75e578547 feat(monitoring): P1/P2 改進 - ArgoCD Metrics + TLS 證書告警
## P1: ArgoCD Metrics
- 新增 ArgoCD Metrics NodePort (30882, 30883)
- 更新 NetworkPolicy 允許 Prometheus (188) 抓取
- 提供 Prometheus scrape config 範本

## P1: NetworkPolicy AI API
- 文檔標註 K8s NetworkPolicy 不支援 FQDN 限制
- 維持現有配置避免 AI 功能中斷

## P2: TLS 證書告警
- 新增 TLSCertExpiringIn30Days (30天預警)
- 新增 TLSCertExpiringIn7Days (7天緊急)
- 新增 TLSCertExpired (已過期)
- 新增 TLSProbeFailure (探測失敗)

## P2: Multi-Sig E2E 測試
- 標記為條件式執行 (API 不可用時自動跳過)
- 避免 CI/CD 因無法連接生產 API 而失敗

首席架構師審查: 2026-03-29 (台北時間)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-28 23:48:57 +08:00

81 lines
2.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# =============================================================================
# ArgoCD Metrics Network Policy - 允許外部 Prometheus 抓取
# =============================================================================
# 建立者: Claude Code (首席架構師)
# 日期: 2026-03-29 (台北時間)
# 用途: 覆蓋 ArgoCD 預設 NetworkPolicy允許 192.168.0.188 (Prometheus) 抓取指標
# =============================================================================
---
# Application Controller Metrics - 允許 Prometheus 抓取
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: argocd-application-controller-network-policy
namespace: argocd
labels:
app.kubernetes.io/component: application-controller
app.kubernetes.io/name: argocd-application-controller
app.kubernetes.io/part-of: argocd
spec:
podSelector:
matchLabels:
app.kubernetes.io/name: argocd-application-controller
policyTypes:
- Ingress
ingress:
# 允許叢集內部存取
- from:
- namespaceSelector: {}
ports:
- port: 8082
protocol: TCP
# 允許外部 Prometheus (188) 抓取指標
- from:
- ipBlock:
cidr: 192.168.0.188/32
ports:
- port: 8082
protocol: TCP
---
# ArgoCD Server Metrics - 允許 Prometheus 抓取
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: argocd-server-network-policy
namespace: argocd
labels:
app.kubernetes.io/component: server
app.kubernetes.io/name: argocd-server
app.kubernetes.io/part-of: argocd
spec:
podSelector:
matchLabels:
app.kubernetes.io/name: argocd-server
policyTypes:
- Ingress
ingress:
# 允許叢集內部存取
- from:
- namespaceSelector: {}
ports:
- port: 8080
protocol: TCP
- port: 8083
protocol: TCP
# 允許外部 Prometheus (188) 抓取指標
- from:
- ipBlock:
cidr: 192.168.0.188/32
ports:
- port: 8083
protocol: TCP
# 允許外部使用者訪問 UI (NodePort 30443)
- from:
- ipBlock:
cidr: 192.168.0.0/24
ports:
- port: 8080
protocol: TCP