SuperApp Backend/ Backend_Iac
GitOps source of truth

สถาปัตยกรรม SuperApp Backend บน AKS

repo Backend_Iac เป็น source-of-truth สำหรับ deploy backend ทั้ง 16 microservices ขึ้น Azure Kubernetes Service ด้วย GitOps — ทุกอย่างในหน้านี้ verified กับ manifest จริง ไม่ใช่เอกสารยุคแรก

Synced · Healthy · verified 2026-06-19
namespace superappdev / sit key vault sua-azure-nonprd-kv argocd branch development service account centralize-aks-sa ingress nginx-internal
Runtime · request path

Service architecture

request เดินทางจาก client ผ่าน Azure APIM (ชั้นนอกสุด ทำหน้าที่ session façade) เข้าสู่ AKS cluster ที่มี nginx-internal ingress กระจายไป 16 microservices แต่ละ service เป็น ClusterIP, รัน Workload Identity เดียวกัน และเชื่อมออกไปยัง Azure backing services สามตัว: Key Vault, Service Bus, PostgreSQL

Client / browser Azure APIMSession façade · resolve JWT AKS cluster — superappdev / sit nginx-internal ingressRoutes /api/{svc} → pod port 16 backend microservicesClusterIP · SA centralize-aks-saWorkload Identity enabled Azure Key Vaultsua-azure-nonprd-kv Azure Service Bus14 topics · 13 subs PostgreSQLFlexible Server

Request path ที่ต้องรู้

16 services (ยึดจาก ArgoCD ApplicationSet dev)

user5111
sentinel-gateway5100
notification5200
filemanagement5500
filter5201
log5300
thirdparty5000
consent5008
codex5202
redisinsight5540
workflow9009
centralized5009
thirdpartyfx5001
task5600
fxcontract5059
orchestratorsaga
fx-service8080 ⚠
fxorchestrator5060 ⚠

fx-service และ fxorchestrator-service มี manifest ครบและอยู่ใน port report แต่ ไม่ปรากฏใน dev appset — ต้อง verify ว่าตั้งใจ deploy แยกหรือยังไม่ผูก ArgoCD

Delivery · GitOps pipeline

Deployment flow

ไม่มีใคร kubectl apply ด้วยมือ — Git คือ source-of-truth ทั้งหมด CI สร้าง image แล้ว commit image tag ใหม่กลับเข้า repo, ArgoCD เฝ้าดู Git แล้ว sync ลง cluster อัตโนมัติ

Developer pushservice code → Azure Repos Azure DevOps CItest · build · push to ACR Update manifestnew image tag → Backend_Iac ArgoCD ApplicationSetauto-sync · self-heal · prune AKS namespaceapply to superappdev / sit
⚠ rollback ที่ถูกต้อง

kubectl rollout undo เป็นแค่ชั่วคราว เพราะ selfHeal จะดึงกลับตาม Git ภายใน ~30s — ต้อง revert image tag ใน manifest แล้ว push ถึงจะถาวร

Secrets · Key Vault + CSI

Secret management flow

secret ทั้งหมดอยู่ใน Azure Key Vault ดึงเข้า pod ผ่าน CSI Secrets Store driver ด้วย Workload Identity แล้ว sync เป็น K8s Secret ก่อน inject เข้า .NET IConfiguration

Azure Key Vaultsua-azure-nonprd-kv CSI Secrets Store driverWorkload Identity · mounts volume SecretProviderClass{svc}-service-kv-secrets K8s Secret (synced){svc}-service-secrets Pod envFrom.NET IConfiguration (__ = :)
⚠ naming ที่พลาดบ่อย

SPC ชื่อ {svc}-service-kv-secrets แต่ K8s Secret ที่ sync ออกมาชื่อ {svc}-service-secretsคนละ object คนละชื่อ เวลา debug ต้องเรียก kubectl get secretproviderclass กับ kubectl get secret ให้ถูกตัว

Ground truth · manifest vs stale docs

เอกสารเก่าขัดกับ manifest จริง

README.md และ STRUCTURE_OF_CODE.md เป็นเอกสารยุคแรก (อ้าง 8–10 service, identity/KV เดิม) ขณะที่ระบบโตเป็น 16 service และเปลี่ยน identity ไปแล้ว — ให้ยึด manifest จริงเสมอ

หัวข้อเอกสารเก่าบอกmanifest จริง (verified)
จำนวน service8 – 1016 services
ServiceAccountbff-service-sacentralize-aks-sa
Key Vaultsua-az-dev-kvsua-azure-nonprd-kv
WI client-ide79ca974…8bc68e37…
Image tagdev-0.0.29 (semver)dev-650ce0b (SHA)
Ingress backend portport 80container port (user 5111)
branch ของ devdevelopdevelopment