vmauth: mount internal root CA + SSL_CERT_FILE for Keycloak OIDC discovery (fix x509)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
wbsong111
2026-06-25 16:06:14 +09:00
parent 7ddb1f062d
commit 9fab760992
2 changed files with 24 additions and 9 deletions
+9 -9
View File
@@ -255,8 +255,8 @@ kubectl apply -n monitoring -f manifests/helm/perses/0.21.0/files/perses-dashboa
| Application | wave | Sync | Health | | Application | wave | Sync | Health |
|-------------|------|------|--------| |-------------|------|------|--------|
| vmcluster | 0 | ⚠️ OutOfSync | ✅ Healthy | | vmcluster | 0 | Synced¹ | ✅ Healthy |
| vlogs | 0 | ⚠️ OutOfSync | ✅ Healthy | | vlogs | 0 | Synced¹ | ✅ Healthy |
| kube-state-metrics | 0 | ✅ Synced | ✅ Healthy | | kube-state-metrics | 0 | ✅ Synced | ✅ Healthy |
| node-exporter | 0 | ✅ Synced | ✅ Healthy | | node-exporter | 0 | ✅ Synced | ✅ Healthy |
| alertmanager | 0 | ✅ Synced | ✅ Healthy | | alertmanager | 0 | ✅ Synced | ✅ Healthy |
@@ -267,7 +267,7 @@ kubectl apply -n monitoring -f manifests/helm/perses/0.21.0/files/perses-dashboa
| vmalert | 1 | ✅ Synced | ✅ Healthy | | vmalert | 1 | ✅ Synced | ✅ Healthy |
| perses | 2 | ✅ Synced | ✅ Healthy | | perses | 2 | ✅ Synced | ✅ Healthy |
> ⚠️ **vmcluster/vlogs OutOfSync (무해, 기능 정상)** — 원인: `vmstorage`/`vlstorage` **StatefulSet `volumeClaimTemplates`** K8s 자동 추가하는 `volumeMode: Filesystem`이 차트 렌더본엔 없어 diff 발생. volumeClaimTemplates는 **immutable**이라 sync로 제거 불가 → 영구 OutOfSync(ArgoCD+StatefulSet 전형). 파드 Running·PVC Bound로 **기능 영향 없음**. **개선책**: ApplicationSet `ignoreDifferences`(StatefulSet `/spec/volumeClaimTemplates`) 추가 → §8 backlog. > ¹ **vmcluster/vlogs (해결됨)** — 초기엔 `vmstorage`/`vlstorage` **StatefulSet `volumeClaimTemplates`** K8s 자동 기본값(`volumeMode`) diff로 영구 OutOfSync였음(immutable). **개선 반영**: ApplicationSet `ignoreDifferences`(StatefulSet `/spec/volumeClaimTemplates`) 추가 → **11/11 Synced** 확인(2026-06-25).
--- ---
@@ -286,7 +286,7 @@ vm-stack `test/` 패턴(port-forward + curl) 적응.
| 7 | 알림 | ✅ vmalert 규칙 **8개**(cluster-health) 로드, alertmanager Running. Discord는 **mock**이라 실발송 미검증 | | 7 | 알림 | ✅ vmalert 규칙 **8개**(cluster-health) 로드, alertmanager Running. Discord는 **mock**이라 실발송 미검증 |
**발견사항 (E2E)** **발견사항 (E2E)**
- ⚠️ **`unauthorized_user` 폴백 → account 0 무인증 접근 가능**: 토큰 없음·무효 토큰도 HTTP 200(acct0)으로 응답. vmalert는 vmselect multitenant에 직결하므로 `unauthorized_user`가 꼭 필요하진 않음 → account 0 보호가 필요하면 **`unauthorized_user` 제거 검토**. - **`unauthorized_user` 폴백 → 제거 완료(해결)**: 초기엔 무토큰/무효토큰도 acct0 200이었음. vmalert는 vmselect 직결이라 폴백 불필요 → **`unauthorized_user` 제거 반영**. 재검증: 무토큰/무효토큰 **모두 401**, 유효 JWT는 정상(2026-06-25).
- perses 데이터소스/시크릿(`perses-provisioning`)은 §3.5에서 누락했다가 E2E 중 적용 → 정식 배포 시 ArgoCD 경로 또는 dip-console로 포함 필요. - perses 데이터소스/시크릿(`perses-provisioning`)은 §3.5에서 누락했다가 E2E 중 적용 → 정식 배포 시 ArgoCD 경로 또는 dip-console로 포함 필요.
> 🔧 **수동 설정**(E2E 일회성): perses-provisioning apply(`kubectl apply -n monitoring -f .../perses-provisioning.yaml`), 검증 토큰 발급(perses-vmauth client_credentials), port-forward 다수 → §7 > 🔧 **수동 설정**(E2E 일회성): perses-provisioning apply(`kubectl apply -n monitoring -f .../perses-provisioning.yaml`), 검증 토큰 발급(perses-vmauth client_credentials), port-forward 다수 → §7
@@ -329,11 +329,11 @@ vm-stack `test/` 패턴(port-forward + curl) 적응.
- **환경**: (클러스터/ArgoCD/Keycloak) - **환경**: (클러스터/ArgoCD/Keycloak)
- **일시 / 수행자**: 2026-06-25 - **일시 / 수행자**: 2026-06-25
- **환경**: dev 클러스터(192.168.1.101), ArgoCD=`platform` ns, Keycloak `paasup` realm - **환경**: dev 클러스터(192.168.1.101), ArgoCD=`platform` ns, Keycloak `paasup` realm
- **결과**: 0~3단계 통과. **11 Application Healthy**(9 Synced + 2 OutOfSync 무해), **15/15 파드 Running**, E2E 핵심 항목 PASS(메트릭·로그·JWT 라우팅·알림 규칙), perses 로그인/admin OK - **결과**: 0~3단계 통과 + 개선 반영. **11/11 Application Synced + Healthy**, **15/15 파드 Running**, E2E 핵심 항목 PASS(메트릭·로그·JWT 라우팅·알림 규칙), perses 로그인/admin OK
- **발견 이슈 / 개선사항**: - **발견 이슈 / 개선사항 (반영 결과)**:
- **vmcluster/vlogs 영구 OutOfSync** — StatefulSet `volumeClaimTemplates`의 `volumeMode` 자동 기본값 diff(immutable). 기능 무해. → ApplicationSet `ignoreDifferences`(StatefulSet `/spec/volumeClaimTemplates`) 추가 권장. - **vmcluster/vlogs OutOfSync 해결** — ApplicationSet `ignoreDifferences`(StatefulSet `/spec/volumeClaimTemplates`) 추가 → 11/11 Synced.
- **`unauthorized_user` → account 0 무인증 접근** — 무토큰/무효토큰도 acct0 200. vmalert는 vmselect 직결이므로 보호 필요 시 `unauthorized_user` 제거 검토. - **`unauthorized_user` 제거 완료** — vmauth 미인증 접근 차단(무토큰/무효토큰 401). vmalert는 vmselect 직결.
- **perses 데이터소스/시크릿 누락** — §3.5에서 대시보드만 적용, datasource provisioning은 E2E 중 추가. 정식 배포 시 ArgoCD 경로/ dip-console로 포함. - **perses 데이터소스/시크릿** — E2E 중 `perses-provisioning` 수동 apply. 정식 배포 시 ArgoCD 경로(또는 dip-console)로 포함 필요 (남은 backlog).
- **Perses OIDC login = `preferred_username`** (v0.53.1 실측) — globalAdminUsers/RoleBinding은 username 기준(앞서 "sub UUID" 가정은 오류, 정정함). - **Perses OIDC login = `preferred_username`** (v0.53.1 실측) — globalAdminUsers/RoleBinding은 username 기준(앞서 "sub UUID" 가정은 오류, 정정함).
- ArgoCD 설치 위치 `platform` ns — ApplicationSet ns를 `platform`으로 조정함. - ArgoCD 설치 위치 `platform` ns — ApplicationSet ns를 `platform`으로 조정함.
- **자동화 backlog**: §7 수동 설정 목록 참조 (1단계 전부 dip-console 이관 대상) - **자동화 backlog**: §7 수동 설정 목록 참조 (1단계 전부 dip-console 이관 대상)
@@ -24,6 +24,21 @@ resources:
cpu: 200m cpu: 200m
memory: 128Mi memory: 128Mi
# Keycloak(사내 CA 서명) OIDC discovery/JWKS 검증용 CA 마운트.
# 없으면 vmauth가 issuer의 .well-known/openid-configuration을 TLS 검증 못 해(x509)
# OIDC verifier 초기화 실패 → 모든 JWT 검증 불가(401). root-ca-cert는 사전조건 Secret.
extraVolumes:
- name: ca-cert
secret:
secretName: root-ca-cert
extraVolumeMounts:
- name: ca-cert
mountPath: /ca
readOnly: true
env:
- name: SSL_CERT_FILE # Go crypto/x509가 사내 CA를 신뢰하도록 지정
value: /ca/ca.crt
config: config:
users: users:
# ── 권장: Keycloak JWT 검증 + vm_access 동적 라우팅 ────────────────────── # ── 권장: Keycloak JWT 검증 + vm_access 동적 라우팅 ──────────────────────