diff --git a/history/2026-05-17-safeline-pvc-fsck-incompat.md b/history/2026-05-17-safeline-pvc-fsck-incompat.md new file mode 100644 index 0000000..5aa063d --- /dev/null +++ b/history/2026-05-17-safeline-pvc-fsck-incompat.md @@ -0,0 +1,136 @@ +--- +date: 2026-05-17 +topic: SafeLine RWX PVC ext4 호환성 인시던트 — Longhorn v1.11.2 strict fsck 거부 +areas: [infra/platform/longhorn, infra/security/crowdsec-safeline] +--- + +# 2026-05-17 / SafeLine RWX PVC 손상 복구 — Longhorn 1.11.2 share-manager strict fsck + +## 증상 + +`/sc:test` 클러스터 상태 점검 중 발견: + +- `safeline-mgt` Pod: `CrashLoopBackOff` (restart 1008회, 3일 15시간) +- `safeline-luigi` Pod: `Init:0/1` (43시간 wait, mgt:1443 폴링) +- 그 외 SafeLine pods (chaos/database/detector/fvm) 정상 + +mgt 로그: +``` +panic: failed to init models: init empty license error: database disk image is malformed (11) + /work/initialize/pg_init.go:82 + SELECT * FROM `options` WHERE key = "license" +``` + +표면적으로는 SQLite SQLITE_CORRUPT(11). 실제 SafeLine 메인 DB(PostgreSQL `safeline-database-0`)는 정상. + +## 근본 원인 + +mgt를 scale 0으로 내리고 디버그 pod로 PVC mount 시도하니 `FailedAttachVolume "Waiting for volume share to be available"` — Longhorn share-manager pod가 1초만에 Failed로 죽고 2분 backoff 사이클 반복. share-manager 로그 캡처: + +``` +/dev/longhorn/pvc-8534d9f3-...: Resize inode not valid. +UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY. + (i.e., without -a or -p options) +fatal: 'fsck' found errors on device but could not correct them +``` + +즉 **ext4 superblock metadata 손상** (`Resize inode not valid`)으로 share-manager가 자동 모드 fsck (`-a`/`-p`)로 거부 → NFS export 못함 → 모든 PVC mount 실패. + +[[2026-05-07-longhorn-1-11-2-upgrade]] 업그레이드에서 share-manager 이미지가 v1.11.2로 바뀌면서 fsck strict 모드로 동작. 옛 fs metadata와 호환성 깨진 것이 주범으로 판단. 실제 데이터는 정상일 가능성 매우 큼 (수동 `fsck -y` 한 번이면 풀림). + +## 영향 받은 PVC + +같은 시점에 만들어진 `incus-hp2` 노드의 RWX PVC 3개 모두 동일 패턴: + +| PVC | 옛 PV | 상태 | +|---|---|---| +| `safeline/safeline-mgt` | `pvc-8534d9f3-91b9-49c3-9acd-804581c51893` | Released (Retain 보존) | +| `safeline/safeline-tengine-logs` | `pvc-15af4f6d-6129-4858-ae51-a3aa3546c4c2` | Released (Retain 보존) | +| `safeline/safeline-luigi` | `pvc-3c39ef90-d8ea-402d-8363-772ddbaf56a2` | Released (Retain 보존) | + +같은 노드의 다른 RWX 4개 (chaos/detector/detector-logs/8f9bfed6)는 mount 유지 중이라 영향 없음 — 다음 재기동 시 동일 에러 가능성. + +## 시도한 조치 + +1. **Longhorn snapshot revert (2026-05-13 16:03, `52eb920e`, 손상 직전 시점)** — 실패. blockdev revert로 ext4 metadata도 같이 복원되어 동일 fsck 에러 재현. +2. **PVC 폐기 + 동일 이름 새 PVC 생성** — 성공. 새 mkfs.ext4로 만들어진 fs는 strict fsck 통과. + +## 복구 절차 (재사용 가능) + +```sh +NS=safeline +NAME=safeline-mgt # 손상 PVC 이름 +SIZE=1Gi # 동일 사이즈 + +# 1. 워크로드 내림 +kubectl -n $NS scale deploy $NAME --replicas=0 + +# 2. PV reclaim Retain으로 변경 (포렌식용 보존) +PV=$(kubectl -n $NS get pvc $NAME -o jsonpath='{.spec.volumeName}') +kubectl patch pv $PV -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}' + +# 3. PVC 삭제 (PV는 Released 상태로 살아남음) +kubectl -n $NS delete pvc $NAME + +# 4. 동일 이름 새 PVC 생성 +cat <\",\"disableFrontend\":true,\"attachedBy\":\"manual\"}' + curl -X POST $LH/v1/volumes/$VOL?action=snapshotRevert \ + -d '{\"name\":\"snapshot-\"}' + curl -X POST $LH/v1/volumes/$VOL?action=detach -d '{}' +" +``` + +## 잠재 위험 (TODO) + +- 같은 노드/같은 시점 mkfs된 다른 RWX 볼륨도 share-manager 재기동 시 동일 에러 가능. 사전 점검 가치 있음 — 한 번씩 detach/reattach 사이클 돌려 fail하는 PVC 식별 후 미리 교체. +- 또는 share-manager의 fsck 옵션을 `-y`로 patch (Longhorn 자체 코드 수정 필요, upstream 이슈로 보고 권장). + +## 관련 + +- [[../infra/platform/longhorn]] — Longhorn 플랫폼 정본 +- [[../infra/security/crowdsec-safeline]] — SafeLine ↔ CrowdSec 연동 +- [[2026-05-07-longhorn-1-11-2-upgrade]] — 직전 업그레이드 diff --git a/history/_index.md b/history/_index.md index d8c2bd0..fc00bc1 100644 --- a/history/_index.md +++ b/history/_index.md @@ -35,3 +35,4 @@ tags: [moc, history] | [[2026-04-25-netbis-npm-vector-msg-rewrite]] | NPM Vector `_msg` 재합성 (proxy_v2 → nginx combined) — child-nginx-logs unparsed 84% 해결 | | [[2026-04-26-bouncer-consolidation]] | CrowdSec bouncer 단일화 (netbis-cf-firewall만 유지, 나머지 3종 + Edge Script 64811 + Turnstile 위젯 6개 폐기) | | [[2026-05-04-amd-iommu-freeze]] | incus-kr2 AMD-Vi (IOMMU) Completion-Wait timeout 호스트 부분 hang — `iommu=pt` 적용 | +| [[2026-05-17-safeline-pvc-fsck-incompat]] | SafeLine RWX PVC (mgt/luigi/tengine-logs) ext4 `Resize inode not valid` — Longhorn v1.11.2 strict fsck 거부, PVC 재생성으로 복구 |