SGLang Gemma4 llm-serving 클러스터 운영
티켓 #42 — didim-gpu 노드의 SGLang Gemma4 12b/31b 배치·삭제·GPU 경합 기록.
노드·용량
- Node
didim-gpuReady; DiskPressure=False; allocatablenvidia.com/gpu=2. sglang-gemma4-12b×2 Running(각 1 GPU)이 기본 점유 → 31b(요청 GPU=2)는 Pending 가능.
31b 삭제 closeout (2026-07-30)
Eric 지시: 클러스터에서 31b 제거, 레포 소스 유지 (manifests/apps/sglang-gemma4-31b.yaml).
kubectl delete deployment sglang-gemma4-31b -n llm-serving
# 초기 leftover: Service sglang-gemma4-31b (empty endpoints)
# SA sw-factory:cursor-agent 는 services 삭제 Forbidden → Eric/RBAC로 Service 정리- Closeout 확인:
llm-serving에sglang-gemma4-31bDeploy/Svc/Pod/Ingress/PVC 없음(Eric이 leftover Service 삭제). - 12b는 2/2 Running 유지. ops-only — git-ship/PR 없음.
GPU 경합 교훈
| 워크로드 | GPU 요청 | 상태(삭제 전) |
|---|---|---|
| 12b ×2 | 1+1 | Running |
| 31b ×1 | 2 | Pending(~23d) — 노드 allocatable=2 전량 12b 점유 |
31b를 다시 올릴 때는 12b 스케일을 먼저 줄이거나 노드 GPU를 늘린다.
일일 점검 기준선
- 기본 점유(서빙 ON):
sglang계열 복제본이 노드 allocatable GPU를 전량 Ready로 쓰는 상태를 정상으로 본다(예: 2 GPU → 2/2). - 서빙 OFF(의도적 scale-0):
llm-serving/sglang-gemma4-12breplicas=0이면 empty endpoints·Ready 0/0은 정상. 프록시 풀(runtime/pgbouncer-{ro,rw})과 같은 allowlist 축 — K8s-Intentional-Scale-Zero-Empty-Endpoints.md. - 노드
DiskPressure/MemoryPressure/PIDPressure=False를 (서빙 ON일 때) GPU Ready와 함께 확인한다. - 보조 추론 서비스(예: TEI) Ready는 GPU 전량 점유와 병행 가능한 정상 신호로 본다(2026-08-09·2026-08-16·2026-08-18·2026-08-22 재확인:
bge-m3-tei1/1 +sglang-gemma4-12b2/2;/v1/models200). - 재확인 (2026-08-22): 노드 Pressure=False·postgres live 4Gi/request 2Gi Ready — OOM/eviction 경로 없음. K8s-Kubelet-Node-Pressure-Eviction.md.
- 재확인 (2026-09-04):
sglang-gemma4-12b+pgbouncer-{ro,rw}intentional scale-0 · abnormal Pod/Warning=0 · postgres Ready → Incident 없음(서빙 ON 기준선과 병행 문서화). - 재확인 (2026-09-05):
sglang-gemma4-12bscale-0 +sglang-gemma4-31b2/2 Ready(노드 GPU 전량) +pgbouncer-{ro,rw}scale-0. 활성 티어가 31b이면 smoke·클라이언트 FQDN도 31b Service를 본다 — Client env vs live model id drift. 12b empty endpoints는 allowlist. - 재확인 (2026-09-06):
sglang-gemma4-12b+pgbouncer-{ro,rw}intentional scale-0 · abnormal Pod/Warning=0 · postgres Ready → Incident 없음(서빙 OFF 기준선; 활성 GPU Deploy 미관측 시 smoke 스킵). - 재확인 (2026-09-09):
sglang-gemma4-12bscale-0 +sglang-gemma4-31b2/2 Ready(노드 GPU 전량 2/2 할당) +bge-m3-teiReady +pgbouncer-{ro,rw}scale-0. postgres live 4Gi/2Gi·Warning/CrashLoop/Pending=0 → Incident 없음. - 재확인 (2026-09-10):
sglang-gemma4-12bscale-0 +sglang-gemma4-31b1/1 Ready +pgbouncer-{ro,rw}scale-0. postgres live 4Gi/2Gi·restarts 0·Warning/CrashLoop/Pending=0·PVC Bound → Incident 없음. 점검 worktree는 feature 브랜치(feature/775-postgres-memory-4gi) untracked 상태로 git pull 미수행 기준선 준수. - TEI health 포트 오탐: ClusterIP health는 컨테이너/Service listen 포트(예: :8080)로 확인한다. 관례적
:80타임아웃만으로 Down/Incident로 올리지 않는다. - SGLang smoke 포트: Service listen이 :30000이면
/v1/models·tiny completion을 그 포트로 친다. 관례적:8000타임아웃만으로 사고 취급하지 않는다(TEI:80vs:8080과 같은 축). 서빙 scale-0이면 smoke 스킵.
Context length 사다리 (12b / 1×4090)
API max_model_len은 **SGLang --context-length**가 결정한다(모델 카드 상한과 혼동 금지).
| 단계 | args | 관측 요지 |
|---|---|---|
| 16K | --context-length 16384 | 에이전트 도구 페이로드 overflow의 전형적 상한 |
| 32K | 32768, mem-fraction-static 0.75 | 16K BadRequest 해소; KV pool≈35k면 64K 불가 |
| 40K | 40960 + --kv-cache-dtype fp8_e4m3 | max_total_num_tokens가 context 이상으로 확보될 때만 |
# 개념: length만 올리면 KV pool < context → 실패. fp8로 capacity 확보 후 검증
# verify: max_model_len == 목표, smoke prompt_tokens>~18k without BadRequestfp8는 용량/정밀도 트레이드오프이지 새 listen/auth surface가 아니다. 제품 쪽 트림과 병행 — LLM-Tool-Payload-Context-Trim.md.
Client env vs live model id drift
에이전트/PVC에 박힌 .env가 스케일 0·삭제된 구 Deploy FQDN(예: 12b)을 가리키면 live가 31b를 서빙해도 클라이언트가 실패한다. 정본은 DESIGN/.env.example의 현재 Service FQDN·모델 id이며, gitignored env는 코드 기본값과 어긋나면 env만 맞춘다(불필요 rollout 금지).
# 개념: live /v1/models id ↔ 클라이언트 BASE_URL·MODEL 정합
curl -sS http://<svc>.llm-serving.svc.cluster.local:30000/v1/models
# PVC/로컬 .env가 dead Deploy를 가리키면 example 값으로 교정 후 smokeGit vs live drift (context/fp8)
live Deployment가 이미 40960+fp8_e4m3인데 git manifest가 32768로 남으면 클러스터 재롤아웃이 아니라 git sync가 정본이다.
# 개념: manifest args + verify-sglang.sh MIN=목표 + README를 live와 맞춤
# live 이미 목표면 kubectl rollout 불필요 — drift만 닫는다길이만 올리는 PR은 KV pool < context면 실패한다. 사다리 표(§ Context length)와 LLM-Tool-Payload-Context-Trim.md를 함께 본다.