refactor: organize infra/ into compute/network/security/data/platform
This commit is contained in:
94
infra/compute/hosts.base
Normal file
94
infra/compute/hosts.base
Normal file
@@ -0,0 +1,94 @@
|
||||
filters:
|
||||
and:
|
||||
- file.hasProperty("type")
|
||||
- property("type") == "host"
|
||||
formulas:
|
||||
display_ip: 'if(property("public_ip"), property("public_ip"), property("tailscale_ip"))'
|
||||
properties:
|
||||
note.title:
|
||||
displayName: 호스트
|
||||
note.location:
|
||||
displayName: 지역
|
||||
note.host_kind:
|
||||
displayName: 종류
|
||||
note.provider:
|
||||
displayName: 공급자
|
||||
note.cpu_cores:
|
||||
displayName: 코어
|
||||
note.ram_gb:
|
||||
displayName: RAM(GB)
|
||||
note.k3s_role:
|
||||
displayName: K3s
|
||||
note.monthly_cost_usd:
|
||||
displayName: 월비용($)
|
||||
note.critical:
|
||||
displayName: Critical
|
||||
note.status:
|
||||
displayName: 상태
|
||||
views:
|
||||
- type: table
|
||||
name: 전체 호스트
|
||||
order:
|
||||
- note.title
|
||||
- note.location
|
||||
- note.host_kind
|
||||
- note.cpu_cores
|
||||
- note.ram_gb
|
||||
- note.k3s_role
|
||||
- note.monthly_cost_usd
|
||||
- note.status
|
||||
sort:
|
||||
- property: note.location
|
||||
direction: ASC
|
||||
- property: note.title
|
||||
direction: ASC
|
||||
- type: table
|
||||
name: 서울 서버
|
||||
filters:
|
||||
and:
|
||||
- property("location") == "seoul"
|
||||
order:
|
||||
- note.title
|
||||
- note.host_kind
|
||||
- note.cpu_cores
|
||||
- note.ram_gb
|
||||
- note.k3s_role
|
||||
- note.critical
|
||||
sort:
|
||||
- property: note.ram_gb
|
||||
direction: DESC
|
||||
- type: table
|
||||
name: K3s 노드
|
||||
filters:
|
||||
and:
|
||||
- property("k3s_role") != null
|
||||
order:
|
||||
- note.title
|
||||
- note.k3s_role
|
||||
- note.location
|
||||
- note.cpu_cores
|
||||
- note.ram_gb
|
||||
- note.lan_ip
|
||||
- type: table
|
||||
name: 유료 호스트 (월비용)
|
||||
filters:
|
||||
and:
|
||||
- property("monthly_cost_usd") > 0
|
||||
order:
|
||||
- note.title
|
||||
- note.provider
|
||||
- note.location
|
||||
- note.monthly_cost_usd
|
||||
- note.status
|
||||
sort:
|
||||
- property: note.monthly_cost_usd
|
||||
direction: DESC
|
||||
- type: card
|
||||
name: Critical 호스트
|
||||
filters:
|
||||
and:
|
||||
- property("critical") == true
|
||||
order:
|
||||
- note.title
|
||||
- note.location
|
||||
- note.k3s_role
|
||||
58
infra/compute/hosts/incus-hp1.md
Normal file
58
infra/compute/hosts/incus-hp1.md
Normal file
@@ -0,0 +1,58 @@
|
||||
---
|
||||
title: incus-hp1
|
||||
updated: 2026-04-16
|
||||
tags: [infra, host, incus, k3s, seoul]
|
||||
type: host
|
||||
host_kind: server
|
||||
location: seoul
|
||||
provider: self-hosted
|
||||
status: active
|
||||
ssh_host: incus-hp1
|
||||
public_ip: null
|
||||
tailscale_ip: null
|
||||
lan_ip: 192.168.9.227
|
||||
os: Debian 13
|
||||
cpu_model: Xeon E5-2670
|
||||
cpu_cores: 32
|
||||
ram_gb: 188
|
||||
k3s_role: worker
|
||||
critical: false
|
||||
monthly_cost_usd: 0
|
||||
---
|
||||
|
||||
## 역할
|
||||
|
||||
Incus + K3s 워커 호스트 (서울존). HP ProLiant DL360p Gen8 베어메탈. K3s 클러스터에서 worker(k3s-agent)로 참여.
|
||||
|
||||
## 네트워크
|
||||
|
||||
- LAN: 192.168.9.227 (eno1, 1GbE — 2.5G 어댑터 없음)
|
||||
- iLO: 192.168.9.140 (hp1-ilo.lan)
|
||||
- Tailscale: 미설치
|
||||
|
||||
## 스토리지
|
||||
|
||||
- sda 273G: 시스템 (/ ext4 259G + swap 14G)
|
||||
- nvme0n1 954G: Incus btrfs storage pool `default`
|
||||
|
||||
## Incus
|
||||
|
||||
- 버전: 6.0.4 (Debian 패키지)
|
||||
- storage pool: `default` (btrfs, /dev/nvme0n1)
|
||||
- network: `incusbr0` (10.100.4.1/24, NAT)
|
||||
- profile: default (incusbr0 + root on default pool)
|
||||
|
||||
## K3s
|
||||
|
||||
- 버전: v1.34.5+k3s1
|
||||
- 역할: worker (k3s-agent)
|
||||
- server: https://192.168.9.135:6443 (incus-kr2)
|
||||
- config: /etc/rancher/k3s/config.yaml
|
||||
|
||||
## 상세
|
||||
|
||||
- 2026-04-16 신규 셋업 (Incus + K3s agent)
|
||||
- hp2와 동일 Gen8 스펙이나 2.5G LAN 미탑재 (1G only)
|
||||
- Longhorn replica 참여 시 nvme에 별도 마운트 필요
|
||||
|
||||
상세 인프라 컨텍스트: [[infra-hosts]]
|
||||
43
infra/compute/hosts/incus-hp2.md
Normal file
43
infra/compute/hosts/incus-hp2.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
title: incus-hp2
|
||||
updated: 2026-04-13
|
||||
tags: [infra, host, incus, k3s, seoul]
|
||||
type: host
|
||||
host_kind: server
|
||||
location: seoul
|
||||
provider: self-hosted
|
||||
status: active
|
||||
ssh_host: incus-hp2
|
||||
public_ip: null
|
||||
tailscale_ip: 100.100.52.34
|
||||
lan_ip: 192.168.9.134
|
||||
os: Debian 13
|
||||
cpu_model: Xeon E5-2670
|
||||
cpu_cores: 32
|
||||
ram_gb: 188
|
||||
k3s_role: worker
|
||||
critical: true
|
||||
monthly_cost_usd: 0
|
||||
---
|
||||
|
||||
## 역할
|
||||
|
||||
Incus + K3s 워커 호스트 (서울존). 홈랩 bare-metal 서버. Incus 프로젝트 `default`, `inbest`. K3s 클러스터에서 worker(k3s-agent)로 참여.
|
||||
|
||||
## 주요 워크로드
|
||||
|
||||
- K3s Pod 42개 (2026-04-13 기준): APISIX, Gitea, Outline, VictoriaMetrics, n8n, Teleport 등
|
||||
- Longhorn storage replica 참여
|
||||
- Incus VM: `gitea-runner`, `juice-shop`, `k8s` 등
|
||||
|
||||
## 네트워크
|
||||
|
||||
- LAN: 192.168.9.134 (K3s intra-cluster)
|
||||
- Tailscale: 100.100.52.34
|
||||
|
||||
## 상세
|
||||
|
||||
- Incus 컨테이너이므로 커널은 호스트 bare-metal과 공유 (커널 업데이트는 호스트에서)
|
||||
- 2026-04-13 drain+reboot 테스트 완료 → [[tasks|tasks.md]] 참조
|
||||
|
||||
상세 인프라 컨텍스트: [[infra-hosts]]
|
||||
45
infra/compute/hosts/incus-kr1.md
Normal file
45
infra/compute/hosts/incus-kr1.md
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
title: incus-kr1
|
||||
updated: 2026-04-13
|
||||
tags: [infra, host, incus, k3s, seoul]
|
||||
type: host
|
||||
host_kind: server
|
||||
location: seoul
|
||||
provider: self-hosted
|
||||
status: active
|
||||
ssh_host: incus-kr1
|
||||
public_ip: 220.120.65.245
|
||||
tailscale_ip: 100.84.111.28
|
||||
lan_ip: 192.168.9.214
|
||||
os: Debian 13
|
||||
cpu_model: unknown
|
||||
cpu_cores: null
|
||||
ram_gb: 64
|
||||
k3s_role: control-plane
|
||||
critical: true
|
||||
monthly_cost_usd: 0
|
||||
gpu: GTX 1080 Ti
|
||||
---
|
||||
|
||||
## 역할
|
||||
|
||||
Incus + K3s control-plane 호스트 (서울존). GPU 워크로드 가능(GTX 1080 Ti). Incus 프로젝트 `default`.
|
||||
|
||||
## 주요 워크로드
|
||||
|
||||
- K3s API 서버 (control-plane 2/2)
|
||||
- Patroni PostgreSQL replica 1개 (10.100.3.185)
|
||||
- heimdall 에이전트 컨테이너 (ops 프로젝트)
|
||||
|
||||
## 네트워크
|
||||
|
||||
- LAN: 192.168.9.214
|
||||
- Tailscale: 100.84.111.28
|
||||
- 공인: 220.120.65.245 (LG U+ 회선, OpenWrt 라우터 경유)
|
||||
|
||||
## 상세
|
||||
|
||||
- heimdall ops 에이전트는 이 호스트의 incus 컨테이너에 상주
|
||||
- K3s kine 엔드포인트는 OpenWrt HAProxy 192.168.9.1:5432 → Patroni leader 자동 감지
|
||||
|
||||
상세 인프라 컨텍스트: [[infra-hosts]]
|
||||
47
infra/compute/hosts/zlambda.md
Normal file
47
infra/compute/hosts/zlambda.md
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
title: zlambda
|
||||
updated: 2026-04-13
|
||||
tags: [infra, host, nixos, tokyo, linode]
|
||||
type: host
|
||||
host_kind: vm
|
||||
location: tokyo
|
||||
provider: linode
|
||||
status: active
|
||||
ssh_host: zlambda
|
||||
public_ip: 139.162.71.52
|
||||
tailscale_ip: 100.78.51.18
|
||||
lan_ip: null
|
||||
os: NixOS 25.05
|
||||
cpu_cores: 1
|
||||
ram_gb: 2
|
||||
k3s_role: null
|
||||
critical: false
|
||||
monthly_cost_usd: 5
|
||||
aliases: [sandbox-tokyo]
|
||||
---
|
||||
|
||||
## 역할
|
||||
|
||||
NixOS 베이스 호스트 (도쿄, Linode nano). 이전 `sandbox-tokyo` 장비를 2026-04-08에 Debian → NixOS로 전환. 경량 docker + tailscale + sshd.
|
||||
|
||||
## 이전된/제거된 구성
|
||||
|
||||
- APISIX + etcd (Netbis DR) — 제거
|
||||
- microsocks — 제거
|
||||
- tlsproxy, vault-prod, wg-easy — 제거
|
||||
|
||||
## 현재 구성
|
||||
|
||||
- sshd, tailscale, docker
|
||||
- Linode 프로필: kernel `linode/direct-disk`
|
||||
- BBR + fq + sysctl 튜닝
|
||||
- NixOS configuration: Gitea [kaffa/nixos-infra](https://gitea.inouter.com/kaffa/nixos-infra)
|
||||
- kaffa-macmini: `~/nixos-infra/`
|
||||
- zlambda: `/root/nixos-infra/`
|
||||
|
||||
## 용도 검토
|
||||
|
||||
- K3s worker 편입 후보 (taint geo=tokyo) — [[k3s-migration|검토 중]]
|
||||
- 도쿄 POP 엣지 워크로드 용도
|
||||
|
||||
상세 인프라 컨텍스트: [[infra-hosts]]
|
||||
375
infra/compute/infra-hosts.md
Normal file
375
infra/compute/infra-hosts.md
Normal file
@@ -0,0 +1,375 @@
|
||||
---
|
||||
title: 인프라 호스트 및 네트워크
|
||||
updated: 2026-04-09 정합성 점검 — Incus 3호스트 라이브 전수, ArgoCD/Helm/Vault/etcd/anomaly-detect drift 정리
|
||||
tags: [infra, network, kr-zone, openwrt]
|
||||
---
|
||||
|
||||
## SSH 접속 정보
|
||||
|
||||
인프라 호스트 SSH 접속 정보: incus-jp1 (공인 42.125.196.116, Tailscale 100.109.123.1), incus-kr1 (공인 220.120.65.245, Tailscale 100.84.111.28), incus-hp2 (Tailscale 100.100.52.34), osaka(gw) (ssh root@100.108.39.107, 공인 172.233.93.180), Synology NAS (SSH 불가, Tailscale 100.126.100.82)
|
||||
|
||||
## 서버 상세
|
||||
|
||||
| SSH 호스트 | Tailscale IP | 역할 | 비고 |
|
||||
|-----------|-------------|------|------|
|
||||
| apisix-osaka | 100.108.39.107 | [[apisix]] API Gateway (오사카) | SSH 직접 접속 |
|
||||
| incus-jp1 | 100.109.123.1 | Incus 호스트 (도쿄) | agents, db, default, monitoring 프로젝트 |
|
||||
| incus-kr1 | 100.84.111.28 | Incus+K3s 호스트 (서울) | GTX 1080 Ti, K3s control-plane (LAN 192.168.9.214), default 프로젝트 |
|
||||
| incus-kr2 | 100.119.109.41 | Incus+K3s 호스트 (서울) | K3s control-plane (LAN 192.168.9.135), default, inbest 프로젝트 |
|
||||
| incus-hp1 | — | Incus+K3s 호스트 (서울) | **HP ProLiant DL360p Gen8** 베어메탈, Xeon E5-2670 32코어, 188GB RAM, K3s worker/k3s-agent (LAN 192.168.9.227), 1GbE only (2.5G 미탑재), Tailscale 미설치, default 프로젝트, 2026-04-16 신규 |
|
||||
| incus-hp2 | 100.100.52.34 | Incus+K3s 호스트 (서울) | **HP ProLiant DL360p Gen8** 베어메탈, Xeon E5-2670 32코어, 188GB RAM, 커널 6.12.74+deb13+1 (2026-04-14 업데이트), K3s worker/k3s-agent (LAN 192.168.9.134), default, inbest 프로젝트 |
|
||||
| openwrt-gw | 100.66.60.66 | **OpenWrt 라우터 (서울, critical)** | HAProxy: 80/443 → MetalLB Traefik(192.168.9.53:80/443), 9080/9443 → MetalLB APISIX(192.168.9.50:80/443), **5432 → Patroni PostgreSQL Leader (K3s kine 데이터스토어 진입점, [[postgresql-ha]] 참조)**. 이 노드 다운 시 K3s API/HTTP 진입 모두 중단 |
|
||||
| zlambda (구 sandbox-tokyo) | 100.78.51.18 | [[zlambda|NixOS 베이스 호스트]] (도쿄, Linode `zlambda`) | NixOS 25.05 (Warbler), 공인 139.162.71.52, sshd+tailscale+docker, 2026-04-08 Debian→NixOS 전환 (이전 APISIX/etcd/microsocks/tlsproxy/vault-prod/wg-easy 모두 제거됨), Linode 프로필 kernel=`linode/direct-disk`, BBR+fq+sysctl 튜닝, configuration: Gitea [`kaffa/nixos-infra`](https://gitea.inouter.com/kaffa/nixos-infra) (kaffa-macmini `~/nixos-infra/`, zlambda `/root/nixos-infra/`) |
|
||||
| relay4wd (sandbox-kr2) | 100.103.161.4 | APISIX Gateway (서울, AWS Lightsail) | 공인 52.79.45.166, inbest 포트포워딩, Docker APISIX 3.15.0, Debian 12, nano $5/월, SSH: `ssh -p 2222 admin@relay4wd` (Vault CA), 포트 22는 SFTPGo 리다이렉트 |
|
||||
| synology | LAN 192.168.9.100 / 192.168.205.100 (2.5G) | NAS (시놀로지) | Tailscale 미사용, LAN 접근 |
|
||||
|
||||
## 서울 K3s 클러스터
|
||||
|
||||
서울존 4대(kr1, kr2, hp1, hp2)를 K3s v1.34.5+k3s1 클러스터로 구성. **kr1/kr2는 control-plane, hp1/hp2는 worker(k3s-agent)**.
|
||||
|
||||
| 노드 | LAN IP | OS |
|
||||
|------|--------|----|
|
||||
| incus-hp1 | 192.168.9.227 | Debian 13 (trixie) |
|
||||
| incus-hp2 | 192.168.9.134 | Debian 13 (trixie) |
|
||||
| incus-kr1 | 192.168.9.214 | Debian 13 (trixie) |
|
||||
| incus-kr2 | 192.168.9.135 | Debian 13 (trixie) |
|
||||
|
||||
주요 네임스페이스 (2026-04-09 라이브): api, apisix, argocd, cert-manager, db, democratic-csi, gitea, juiceshop, kroki, kube-system, logging, longhorn-system, mail, mcp, metallb-system, monitoring, mq, n8n, nfs-provisioner, openmemory, outline, rabbitmq-system, safeline, searxng, sftpgo, sshpiper, teleport, test, tools, vault(빈 ns, 서비스만 잔존)
|
||||
|
||||
> vault ns는 빈 상태로 ClusterIP 서비스(`vault-external`)만 잔존 — 실제 Vault 서버는 jp1 incus 컨테이너 (아래 "서비스 위치" 참조).
|
||||
|
||||
게이트웨이: 두 독립 LoadBalancer 병렬 운영 — Traefik (MetalLB VIP 192.168.9.53, 메인 라우팅 14 HTTPRoute + 5 legacy IngressRoute) + APISIX (MetalLB VIP 192.168.9.50, 2026-03-25 축소 이후 `juiceshop.keepanker.cv` 1 route · chaitin-waf SafeLine 통합)
|
||||
|
||||
### MetalLB IPAddressPool
|
||||
|
||||
| 항목 | 값 |
|
||||
|---|---|
|
||||
| Pool | `default-pool`: **`192.168.9.50-192.168.9.99`** (50개, 2026-04-14 확장 전 `.50-.59`) |
|
||||
| L2Advertisement | `default` → default-pool |
|
||||
| 할당 전략 | autoAssign=true (별도 `metallb.universe.tf/loadBalancerIPs` annotation 미사용) |
|
||||
| DHCP 범위 | `192.168.9.150-249` (OpenWrt, 2026-04-14 `.100-.149`에서 밀어 확보) |
|
||||
| 해방 공간 | `192.168.9.100-149` (장래 MetalLB 확장 후보, 단 기존 리스 .110/.128/.149 만료 후 안전) |
|
||||
|
||||
### OpenWrt 정적 DHCP 리스 (iLO)
|
||||
|
||||
HP ProLiant DL360p Gen8 iLO 4 관리 포트. MAC 기반 고정 할당 (uci `dhcp.@host`).
|
||||
|
||||
| 이름 | IP | MAC | 시리얼 | 비고 |
|
||||
|------|-----|-----|--------|------|
|
||||
| `hp1-ilo` | 192.168.9.140 | `6c:3b:e5:b7:0e:4e` | JPT3169F2E | DHCP hostname 잔재 `HP-PVE1`. 2026-04-14 renew 완료 |
|
||||
| `hp2-ilo` | 192.168.9.141 | `6c:3b:e5:b4:57:3e` | JPT3169F6C | DHCP hostname 잔재 `HP-PVE2`, hp2 K3s 노드의 iLO. 2026-04-14 현재 아직 .159 리스 유지 (다음 renew 시 .141로 이전) |
|
||||
|
||||
로컬 DNS: `hp1-ilo.lan`, `hp2-ilo.lan` (dnsmasq 자동). 접근: `https://hp1-ilo.lan/` 또는 `https://192.168.9.140/` (자체서명 cert).
|
||||
|
||||
설정 날짜: 2026-04-14 (이전 동적 할당 .213/.159에서 연속 고정으로 이전).
|
||||
|
||||
현재 할당 (2026-04-14):
|
||||
| IP | 서비스 |
|
||||
|----|--------|
|
||||
| .50 | apisix/apisix-gateway |
|
||||
| .51 | sshpiper/sshpiper |
|
||||
| .52 | teleport/teleport-cluster |
|
||||
| .53 | kube-system/traefik |
|
||||
| .54 | gitea/gitea-ssh |
|
||||
| .55 | sftpgo/sftpgo |
|
||||
| .56-.99 | **여유 44개** |
|
||||
|
||||
확장 절차: `kubectl -n metallb-system patch ipaddresspool default-pool --type=merge -p '{"spec":{"addresses":["<range>"]}}'`.
|
||||
- Traefik DaemonSet, MetalLB LoadBalancer 192.168.9.53 + Gateway API
|
||||
- APISIX Deployment **replica 2**, MetalLB LoadBalancer 192.168.9.50, SafeLine WAF chaitin-waf 플러그인 연동, Admin API 수동 관리
|
||||
- APISIX etcd: K3s 내부 apisix-etcd StatefulSet 3 replicas, prefix `/apisix`
|
||||
- CoreDNS hairpin rewrite: traefik.kube-system.svc.cluster.local
|
||||
- K3s 데이터스토어: kine → HAProxy(192.168.9.1:5432) → Patroni PostgreSQL Leader 자동 감지
|
||||
|
||||
트래픽 흐름:
|
||||
- 일반: 외부 → OpenWrt HAProxy(:80/:443) → MetalLB Traefik(192.168.9.53:80/443) → K3s 서비스
|
||||
- WAF: 외부 → OpenWrt HAProxy(:9080/:9443) → MetalLB APISIX(192.168.9.50:80/443) → SafeLine WAF → K3s 서비스
|
||||
- SafeLine 실시간: SafeLine 차단 → PG NOTIFY → safeline-listener(kr2) → CrowdSec(:8088) → 즉시 IP 밴
|
||||
- K3s kine: K3s → HAProxy(192.168.9.1:5432) → Patroni Leader PostgreSQL
|
||||
|
||||
### Helm 릴리스 (2026-04-09 `helm ls -A` 기준)
|
||||
|
||||
| Release | Namespace | Chart | App Version |
|
||||
|---------|-----------|-------|-------------|
|
||||
| apisix | apisix | apisix-2.13.0 | 3.15.0 |
|
||||
| apisix-ingress-controller | apisix | apisix-ingress-controller-1.1.2 | 2.0.1 |
|
||||
| argocd | argocd | argo-cd-9.4.16 | v3.3.5 |
|
||||
| cert-manager | cert-manager | cert-manager-v1.20.0 | v1.20.0 |
|
||||
| gitea | gitea | gitea-12.5.0 | 1.25.4 |
|
||||
| longhorn | longhorn-system | longhorn-1.8.2 | v1.8.2 |
|
||||
| metallb | metallb-system | metallb-0.15.3 | v0.15.3 |
|
||||
| n8n | n8n | n8n-2.0.1 | 1.122.4 |
|
||||
| nfs-provisioner | nfs-provisioner | nfs-subdir-external-provisioner-4.0.18 | 4.0.2 |
|
||||
| reflector | kube-system | reflector-10.0.21 | 10.0.21 |
|
||||
| safeline | safeline | safeline-10.1.0 | 9.3.2 |
|
||||
| sftpgo | sftpgo | sftpgo-0.44.0 | 2.7.1 |
|
||||
| sshpiper | sshpiper | sshpiper-0.4.6 | v1.5.0 |
|
||||
| synology-iscsi | democratic-csi | democratic-csi-0.15.1 | 1.0 |
|
||||
| traefik | kube-system | traefik-39.0.6 | v3.6.11 |
|
||||
| vector | logging | vector-0.51.0 | 0.54.0-distroless-libc |
|
||||
| vlogs | logging | victoria-logs-single-0.11.31 | v1.49.0 |
|
||||
| vm-stack | monitoring | victoria-metrics-k8s-stack-0.72.6 | v1.139.0 |
|
||||
|
||||
> **주의**: `nfs-provisioner` Helm 릴리스 status=`failed` (revision 2). 실제 파드는 정상 Running. `helm history` 확인 후 정리 필요.
|
||||
>
|
||||
> RabbitMQ Operator는 `rabbitmq-system` ns에서 kubectl apply 직배포 (Helm 미사용).
|
||||
|
||||
### ArgoCD Applications (2026-04-09 라이브)
|
||||
|
||||
| App | Namespace | Repo |
|
||||
|-----|-----------|------|
|
||||
| bunnycdn-mcp | mcp | gitea.inouter.com/kaffa/bunnycdn-mcp (path: k8s) |
|
||||
| cf-bouncer-manager | tools | gitea.inouter.com/kaffa/cf-bouncer-manager (path: k8s) |
|
||||
| namecheap-api | api | gitea.inouter.com/kaffa/namecheap-api (path: k8s) |
|
||||
| smtp-relay | mail | gitea.inouter.com/kaffa/smtp-relay (path: k8s) |
|
||||
| vultr-api | api | gitea.inouter.com/kaffa/vultr-api (path: k8s) |
|
||||
|
||||
|
||||
### kubectl 직접 관리 (Helm/ArgoCD 미적용)
|
||||
|
||||
db (proxysql, pgcat), kroki, mq (RabbitmqCluster CR), openmemory (mcp/ui/qdrant), tools (nocodb), juiceshop, searxng, teleport, test
|
||||
|
||||
### TCP 튜닝 (3노드 공통)
|
||||
|
||||
- BBR 혼잡 알고리즘 + fq qdisc (`/etc/sysctl.d/99-bbr.conf`, `/etc/modules-load.d/bbr.conf`)
|
||||
- tcp_fin_timeout=15, tcp_fastopen=3, netdev_max_backlog=8192, tcp_max_syn_backlog=8192, tcp_keepalive_time=600, ip_local_port_range=1024-65535 (`/etc/sysctl.d/99-tcp-tuning.conf`)
|
||||
|
||||
## 서비스 위치
|
||||
|
||||
| 서비스 | 위치 | 접근 방법 |
|
||||
|--------|------|-----------|
|
||||
| [[apisix]] (오사카) | apisix-osaka (Linode, Docker) | SSH / Admin API |
|
||||
| [[apisix]] (서울) | K3s 클러스터 (apisix ns, Deployment x2 + ingress-controller + etcd 3/3) | kubectl / Admin API (ClusterIP 10.43.70.216:9180, allow: 127.0.0.1/24 + 100.64.0.0/10 + 192.168.9.0/24 + 10.42.0.0/16) |
|
||||
| ArgoCD | K3s 클러스터 (argocd ns) | kubectl / NodePort 30080 |
|
||||
| cert-manager | K3s 클러스터 (cert-manager ns) | kubectl |
|
||||
| [[gitea]] | K3s 클러스터 (gitea ns): gitea, postgresql, valkey | kubectl, gitea.inouter.com |
|
||||
| Kroki | K3s 클러스터 (kroki ns) | kubectl |
|
||||
| Longhorn | K3s 클러스터 (longhorn-system ns): 분산 스토리지 v1.8.2 | kubectl |
|
||||
| n8n | K3s 클러스터 (n8n ns, Helm) | kubectl |
|
||||
| NocoDB | K3s 클러스터 (tools ns, kubectl 직접) | kubectl, nocodb.inouter.com |
|
||||
| OpenMemory | K3s 클러스터 (openmemory ns): mcp, ui, qdrant | kubectl |
|
||||
| Outline | K3s 클러스터 (outline ns): outline + redis | kubectl, outline.inouter.com |
|
||||
| PgCat | K3s 클러스터 (db ns): PostgreSQL pooler | kubectl |
|
||||
| ProxySQL | K3s 클러스터 (db ns) | kubectl |
|
||||
| SafeLine WAF | K3s 클러스터 (safeline ns): detector, mgt, fvm, chaos, luigi, database | kubectl, safeline.inouter.com |
|
||||
| [[vault]] | jp1 incus default 프로젝트 컨테이너 `vault` (10.253.101.58, 2026-03-24~) | incus exec / MCP / Vault API. K3s vault ns는 빈 상태 (`vault-external` ClusterIP만 잔존, 정리 필요) |
|
||||
| BunnyCDN MCP | K3s 클러스터 (mcp ns, ArgoCD) | kubectl |
|
||||
| cfb-manager | K3s 클러스터 (tools ns, ArgoCD `cf-bouncer-manager`): CrowdSec-Firewall-Bouncer 관리 | kubectl |
|
||||
| Namecheap API | K3s 클러스터 (api ns, ArgoCD) | kubectl |
|
||||
| Vultr API | K3s 클러스터 (api ns, ArgoCD) | kubectl |
|
||||
| smtp-relay | K3s 클러스터 (mail ns, ArgoCD) | kubectl |
|
||||
| sftpgo | K3s 클러스터 (sftpgo ns, Helm) | kubectl, SFTP 22 |
|
||||
| sshpiper | K3s 클러스터 (sshpiper ns, Helm) | kubectl |
|
||||
| Teleport | K3s 클러스터 (teleport ns): auth + proxy | kubectl |
|
||||
| searxng | K3s 클러스터 (searxng ns) | kubectl |
|
||||
| juice-shop | K3s 클러스터 (juiceshop ns, 별도 jp1 default 프로젝트에도 컨테이너 존재) | kubectl |
|
||||
| Teleport / sftpgo / sshpiper / searxng / Outline | K3s 클러스터 (각자 전용 ns) | kubectl |
|
||||
| anomaly-detect | hp2 incus default 프로젝트 컨테이너 `anomaly-detect` (10.100.2.164, 2026-04-08~) | incus exec |
|
||||
| Prometheus, Grafana (인프라 metric 백업) | jp1 monitoring 프로젝트 (Grafana 10.253.103.199, Prometheus 10.253.100.193) — 일상 운영은 K3s VictoriaMetrics 스택 사용 | incus exec --project monitoring |
|
||||
| DB 서버 (jp1 db 프로젝트) | jp1 db 프로젝트: etcd-1 | incus exec --project db |
|
||||
| DB (분산 mariadb/postgres) | mariadb-1/postgres-1 (hp2), mariadb-2/postgres-2 (kr1), mariadb-3/postgres-3 (kr2) — 각 서울 노드 default 프로젝트 | incus exec |
|
||||
| etcd (relay4wd용) | jp1 db 프로젝트: etcd-1 (10.253.102.11) | etcd 2379 |
|
||||
| etcd (jp1 default) | jp1 default 프로젝트: etcd (10.253.101.233, 2026-04-06~) — 용도 별도 확인 필요 | incus exec |
|
||||
| BunnyCDN | 외부 SaaS | BunnyCDN MCP 서버 / API |
|
||||
| RabbitMQ | K3s 클러스터 (mq ns): RabbitmqCluster Operator + server-0 | kubectl, Traefik TCPRoute 5672 |
|
||||
| VictoriaMetrics | K3s 클러스터 (monitoring ns): vm-stack (vmsingle 2GB, vmagent 1GB, vmalert, Grafana) | grafana.inouter.com (admin/ironclad2026) |
|
||||
| [[backup]] | kr2 → NAS → R2 | systemd timer, rclone |
|
||||
|
||||
## Incus 프로젝트 (2026-04-09 라이브 전수)
|
||||
|
||||
3호스트 모두 SSH 접속(`ssh incus-jp1/kr2/hp2`, kaffa 계정 incus-admin 그룹) 후 `incus list --all-projects -f csv -c enpstc4`로 수집.
|
||||
|
||||
호스트별 프로젝트 + 인스턴스 카운트:
|
||||
|
||||
| 호스트 | 프로젝트 | 인스턴스 수 | 비고 |
|
||||
|--------|---------|------------|------|
|
||||
| jp1 | agents | 15 | 모두 RUNNING |
|
||||
| jp1 | db | 1 | etcd-1 |
|
||||
| jp1 | default | 20 | RUNNING 18 + STOPPED 2 (baserow, iac-route) |
|
||||
| jp1 | monitoring | 2 | grafana, prometheus |
|
||||
| kr1 | default | 3 | brokkr, mariadb-2, postgres-2 |
|
||||
| kr1 | ops | 1 | heimdall (tofu 관리) |
|
||||
| kr2 | default | 2 | mariadb-3, postgres-3 |
|
||||
| kr2 | inbest | 7 | cloudflared 포함 |
|
||||
| hp2 | default | 5 | anomaly-detect 포함 |
|
||||
| hp2 | inbest | 0 | 프로젝트만 존재, 인스턴스 없음 |
|
||||
|
||||
스토리지 풀: jp1=`btrfs-pool` (btrfs, /dev/sda1 268G/109G used), kr1=`default` (dir, NVMe 937G/115G used), kr2=`default` (dir, NVMe 937G/115G used), hp2=`default` (btrfs, `/dev/mapper/pve-root` 126G/63G used — Proxmox 잔재 LVM 레이아웃).
|
||||
|
||||
호스트 자원: jp1=Xeon E5-2670 32core/31GiB, kr1=28core/62GiB+GTX 1080 Ti, kr2=Ryzen 9 6900HX 16core/30GiB, hp2=Xeon E5-2670 32core/188GiB.
|
||||
|
||||
### jp1 컨테이너
|
||||
|
||||
**agents 프로젝트** (15): anvil, awl, blacksmith, cloak, courier, flux, forge, irondesk, irondesk-openmemory, openclaw, rabbitmq, smelt, stamp, tally, web
|
||||
|
||||
**db 프로젝트** (1): etcd-1 (10.253.102.11)
|
||||
|
||||
**default 프로젝트** (20):
|
||||
- RUNNING 컨테이너: crowdsec (10.253.100.240), cs-cf-worker-bouncer (10.253.100.131), dev-web (10.253.102.169), **etcd** (10.253.101.233, 2026-04-06 신규), hey (10.253.103.80), infra-tool (10.253.100.183), **netbis-cf-bouncer** (10.253.103.33, 2026-04-03 신규), pricing-api (10.253.102.142), **socks5-proxy** (10.253.102.12, 2026-03-21 신규), ssh-test (10.253.102.82), sshpiper (10.253.100.34), telegram-web-client (10.253.102.124), tor-server (10.253.101.178), **vault** (10.253.101.58, 2026-03-24 신규 — K3s 이전 후 인프라 정본), voice-api (10.253.101.7)
|
||||
- RUNNING VM: gitea-runner (10.253.103.203, +docker0), juice-shop (10.253.100.202, +docker0), k8s (10.253.103.124, +flannel/cni0)
|
||||
- STOPPED: baserow (CONTAINER APP, 2026/01/05 마지막 시작), iac-route (CONTAINER, 2026/03/04)
|
||||
|
||||
|
||||
**monitoring 프로젝트** (2): grafana (10.253.103.199), prometheus (10.253.100.193)
|
||||
|
||||
### kr1 컨테이너
|
||||
|
||||
**default 프로젝트** (3): brokkr (10.100.3.54), mariadb-2 (10.100.3.64), **postgres-2** (10.100.3.185)
|
||||
|
||||
**ops 프로젝트** (1): **heimdall** (10.100.3.108, tofu 관리 `kaffa/ops-agents-tofu/heimdall`)
|
||||
|
||||
### kr2 컨테이너
|
||||
|
||||
**default 프로젝트** (2): mariadb-3 (10.100.1.162), **postgres-3** (10.100.1.83)
|
||||
|
||||
**inbest 프로젝트** (7): **cloudflared** (10.100.1.95), mariadb10 (10.100.1.148), nginx (10.100.1.121), php5 (10.100.1.174), php8 (10.100.1.3), phpmyadmin (10.100.1.60), sftp (10.100.1.158)
|
||||
|
||||
### hp2 컨테이너
|
||||
|
||||
**default 프로젝트** (5): **anomaly-detect** (10.100.2.164, 2026-04-08 신규), jarvis (10.100.2.162), mariadb-1 (10.100.2.234), postgres-1 (10.100.2.5), trader (10.100.2.9)
|
||||
|
||||
**inbest 프로젝트** (0): 프로젝트만 존재, 인스턴스 없음 (default profile만 사용 중). kr2 inbest와 페어 구성을 고려해 만들어둔 빈 프로젝트로 보임.
|
||||
|
||||
## GPU
|
||||
|
||||
kr1에 NVIDIA GeForce GTX 1080 Ti (11GB VRAM) 장착. 호스트 드라이버 550.163.01, CUDA 12.4.
|
||||
|
||||
### Incus GPU 이미지
|
||||
|
||||
| 이미지 | 설명 | 크기 |
|
||||
|--------|------|------|
|
||||
| docker-gpu | Debian trixie + Docker CE + NVIDIA Container Toolkit | 295MB |
|
||||
| podman-gpu | Debian trixie + Podman + NVIDIA Container Toolkit (CDI) | 277MB |
|
||||
|
||||
### GPU 컨테이너 사용법
|
||||
|
||||
```bash
|
||||
# 컨테이너 생성
|
||||
incus launch docker-gpu my-container
|
||||
|
||||
# GPU 패스스루 + 호스트 드라이버 자동 주입
|
||||
incus config set my-container nvidia.runtime true
|
||||
incus config device add my-container gpu gpu
|
||||
|
||||
# 컨테이너 안에서 GPU 확인
|
||||
incus exec my-container -- nvidia-smi
|
||||
```
|
||||
|
||||
`nvidia.runtime=true` 설정 시 호스트의 NVIDIA 드라이버 라이브러리가 컨테이너에 자동 마운트됨. 컨테이너 안에 드라이버 설치 불필요.
|
||||
|
||||
Docker: `--runtime=nvidia` 또는 `--gpus all`로 GPU 사용. Podman: CDI 방식, `--device nvidia.com/gpu=all`로 GPU 사용.
|
||||
|
||||
## KR존 네트워크 토폴로지
|
||||
|
||||
```
|
||||
인터넷
|
||||
└── OpenWrt 라우터 (공인 IP: 220.120.65.245, 내부: 192.168.9.1)
|
||||
├── incus-kr1 (192.168.9.214) ← K3s control-plane
|
||||
├── incus-kr2 (192.168.9.135, br-uplink 고정) ← K3s control-plane
|
||||
├── incus-hp1 (192.168.9.227, 1GbE) ← K3s worker (k3s-agent)
|
||||
└── incus-hp2 (192.168.9.134) ← K3s worker (k3s-agent)
|
||||
|
||||
외부 트래픽 흐름 (TCP):
|
||||
인터넷 → OpenWrt HAProxy(:80/:443) → APISIX hostNetwork(:9080/:9443, 3노드 roundrobin) → K3s svc → pods
|
||||
|
||||
외부 트래픽 흐름 (QUIC/HTTP3):
|
||||
인터넷 → OpenWrt nftables DNAT(UDP :443) → APISIX hostNetwork(:9443, numgen mod 3 roundrobin) → K3s svc → pods
|
||||
|
||||
내부 트래픽 흐름:
|
||||
LAN → K3s/APISIX(192.168.9.x:9080/9443) → pods 직접
|
||||
```
|
||||
|
||||
- **게이트웨이**: OpenWrt 라우터 (root@192.168.9.1, SSH user: root)
|
||||
- **OpenWrt HAProxy** (TCP, mode tcp, 3노드 로드밸런싱):
|
||||
- frontend ft_http :80 → backend bk_apisix_http (roundrobin)
|
||||
- frontend ft_https :443 → backend bk_apisix_https (roundrobin)
|
||||
- backend 서버: hp2(192.168.9.134:9080/9443), kr1(192.168.9.214:9080/9443), kr2(192.168.9.135:9080/9443)
|
||||
- stats: :9999 (admin/admin)
|
||||
- **OpenWrt QUIC/HTTP3** (UDP, nftables DNAT):
|
||||
- UDP 443 → numgen inc mod 3 → hp2/kr1/kr2 :9443 roundrobin
|
||||
- CDN IP 필터도 UDP 443에 적용됨
|
||||
- **K3s datastore**: Incus etcd 3노드 클러스터 (192.168.9.214, 192.168.9.135, 192.168.9.134)
|
||||
- `/registry/` — K3s 클러스터 백엔드 스토어
|
||||
- `/patroni/nocodb-cluster` — NocoDB PostgreSQL HA
|
||||
- **APISIX etcd** (K3s 내부): apisix-etcd StatefulSet **3 replicas** (ClusterIP 10.43.20.100:2379, prefix `/apisix`)
|
||||
- **OVN 네트워크**: ovn1 (10.165.246.0/24) — hp2↔kr2 간 오버레이
|
||||
- **CDN IP 필터**: BunnyCDN + Cloudflare IP만 80/443 허용, 그 외 WAN 차단
|
||||
- 스크립트: `/etc/cdn-filter-update.sh`
|
||||
- nftables: `/etc/nftables.d/10-cdn-filter.nft`
|
||||
- 크론: 매일 04:00 업데이트
|
||||
- **Tailscale 광고 대역**: 10.100.1.0/24 (kr2), 10.100.2.0/24 (hp2), 10.100.3.0/24 (kr1), 192.168.9.0/24 (LAN)
|
||||
- **DNS rebind 예외**: inouter.com (OpenWrt dnsmasq)
|
||||
- 공인 IP `220.120.65.245`는 OpenWrt 라우터의 IP
|
||||
|
||||
## 2.5G LAN (192.168.205.0/24)
|
||||
|
||||
백업/대용량 전송용 2.5GbE 직결 네트워크. 4노드 모두 MTU 9000 (jumbo frame).
|
||||
|
||||
| 호스트 | NIC | MAC | 2.5G IP | MTU |
|
||||
|--------|-----|-----|---------|-----|
|
||||
| kr1 | enp7s0 (Realtek RTL8125 PCIe) | b8:fb:b3:c6:07:cf | 192.168.205.214 | 9000 |
|
||||
| kr2 | enx803f5dd34c9f (USB r8152) | 80:3f:5d:d3:4c:9f | 192.168.205.135 | 9000 |
|
||||
| hp2 | ens2 (Realtek RTL8125 PCIe) | b8:fb:b3:c6:06:f0 | 192.168.205.134 | 9000 |
|
||||
| NAS | USB cdc_ncm | - | 192.168.205.100 | 9000 |
|
||||
|
||||
마지막 옥텟은 1G LAN(192.168.9.x)과 동일하게 통일.
|
||||
|
||||
설정 위치 (systemd-networkd):
|
||||
- kr1: `/etc/systemd/network/20-enp7s0.network`
|
||||
- kr2: `/etc/systemd/network/30-usb-2g5.network`
|
||||
- hp2: `/etc/systemd/network/30-ens2.network`
|
||||
|
||||
USB autosuspend/NFS hang 인시던트 이력: [[2026-04-04-usb-25g-hang|2026-04-04 USB 2.5G hang]]
|
||||
|
||||
안정성 대책:
|
||||
- kr2: GRUB `usbcore.autosuspend=-1`, udev rule `99-usb-ethernet.rules` (scatter-gather off)
|
||||
- NAS: `/usr/local/etc/rc.d/usb-no-suspend.sh` 스타트업 스크립트
|
||||
|
||||
## 네트워크 대역
|
||||
|
||||
네트워크 대역: 100.0.0.0/8 (Tailscale VPN), 10.253.0.0/16 (incus-jp1 내부), 10.100.3.0/24 (incus-kr1 incusbr0), 10.100.1.0/24 (incus-kr2 incusbr0), 10.100.2.0/24 (incus-hp2 incusbr0), 10.179.99.0/24 (incus-kr2 APISIX 전용), 10.42.0.0/16 (k8s 파드), 10.43.0.0/16 (k8s 서비스 ClusterIP), 172.17.0.0/16 (Docker 브릿지, 무시), 192.168.9.0/24 (kaffa 로컬 LAN)
|
||||
|
||||
## K3s 클러스터 노드
|
||||
|
||||
| 노드명 | K3s Internal IP | 역할 | 호스트 위치 |
|
||||
|--------|----------------|------|------------|
|
||||
| incus-kr1 | 192.168.9.214 | control-plane | 서울 |
|
||||
| incus-kr2 | 192.168.9.135 | control-plane | 서울 |
|
||||
| incus-hp1 | 192.168.9.227 | worker (k3s-agent) | 서울 |
|
||||
| incus-hp2 | 192.168.9.134 | worker (k3s-agent) | 서울 |
|
||||
|
||||
## IPv6 prefix
|
||||
|
||||
jp1 prefix는 2400:8905:e002:1d02
|
||||
|
||||
## web 컨테이너
|
||||
|
||||
web 컨테이너 (incus agents 프로젝트, IP 10.253.100.159): Caddy :80으로 /var/www/sites 서빙, btrfs-pool/shared-sites 볼륨을 stamp과 공유. ironclad.it.com 랜딩페이지 서빙 용도.
|
||||
|
||||
## 대시보드
|
||||
|
||||
사용 중인 대시보드는 dashboard.inouter.com(내부용)
|
||||
|
||||
## Xray
|
||||
|
||||
Xray VLESS+XHTTP 스텔스 구성
|
||||
|
||||
## 네트워크 정책
|
||||
|
||||
실사용: 국내 트래픽은 직접, 해외는 프록시, 광고는 차단
|
||||
|
||||
## 아카이브 / 미사용 노드
|
||||
|
||||
장기 오프라인 또는 폐기된 호스트의 이력 보존용. tailnet 감사(2026-04-09) 시점 기준.
|
||||
|
||||
| 호스트 | Tailscale IP | 종류 | 마지막 활동 | 비고 |
|
||||
|--------|-------------|------|------------|------|
|
||||
| sandbox-tokyo | (구 100.78.51.18) | Linode VPS (도쿄) | 2026-04-08 폐기 | Debian → NixOS 전환 후 호스트명 `zlambda`로 재정의됨. 위 서버 상세 표 참조 |
|
||||
| safeline-osaka | 100.100.212.6 | Linode VPS (오사카) | offline 49d (~2026-02-19) | SafeLine WAF 단독 호스트였으나 K3s `safeline` ns로 이전 후 미사용. 토큰/시크릿 미등록 (vault.md 참조). 재기동 또는 폐기 결정 필요 |
|
||||
| china-ali | 100.67.31.11 | Aliyun VPS (중국) | offline 43d (~2026-02-25) | 용도 불명 — 과거 중국 리전 테스트용 추정. kappa 확인 후 폐기 또는 정식 등록 결정 필요 |
|
||||
|
||||
과거 마이그레이션 / 인시던트 이력은 `history/` 참조.
|
||||
|
||||
## 개인 워크스테이션
|
||||
|
||||
서버가 아닌 kaffa 개인 디바이스(Mac mini / MacBook / iPhone)는 [[workstations]] (`dev/workstations.md`) 참조. 인프라 정본이 아닌 개발 환경 맥락이라 `dev/` 하위에 분리.
|
||||
13
infra/compute/k3s-migration.md
Normal file
13
infra/compute/k3s-migration.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
title: K3s PostgreSQL 백엔드 이전
|
||||
updated: 2026-03-26
|
||||
status: 완료
|
||||
tags: [k3s, migration, postgresql, supabase]
|
||||
---
|
||||
|
||||
이 문서는 과거 마이그레이션 작업 기록입니다. 전체 내용은 history 파일로 이동했습니다.
|
||||
|
||||
- [[2026-03-24-k3s-postgresql-migration|2026-03-24 K3s PostgreSQL 이전]]
|
||||
- [[2026-04-05-supabase-to-patroni|2026-04-05 Supabase → Patroni 이전]]
|
||||
|
||||
현재 클러스터 구성은 [[infra-hosts]] 참조.
|
||||
143
infra/compute/zlambda.md
Normal file
143
infra/compute/zlambda.md
Normal file
@@ -0,0 +1,143 @@
|
||||
---
|
||||
title: zlambda (Linode 도쿄, NixOS)
|
||||
updated: 2026-04-08
|
||||
aliases: [sandbox-tokyo, sandbox-tokyo-nixos]
|
||||
tags: [nixos, linode, zlambda, infra]
|
||||
---
|
||||
|
||||
## 개요
|
||||
|
||||
Linode Tokyo VM (라벨 `zlambda`, id 47271589). NixOS 25.05 (Warbler), nixos-anywhere로 설치. 옛 이름 `sandbox-tokyo`는 Mac ssh config alias로만 남아 있음.
|
||||
|
||||
NixOS 전환 이력: [[2026-04-08-zlambda-nixos-migration|history]]
|
||||
|
||||
## 접속
|
||||
|
||||
| 방법 | 명령 |
|
||||
|------|------|
|
||||
| Tailscale (정식) | `ssh root@zlambda` (100.78.51.18) |
|
||||
| Tailscale (alias) | `ssh root@sandbox-tokyo` ← Mac ssh config alias로만 동작 |
|
||||
| 공인 IP | `ssh root@139.162.71.52` |
|
||||
| LISH 콘솔 | `ssh -tt netbis@lish-tokyo2.linode.com zlambda` (Linode profile.authorized_keys에 kaffa-Macmini RSA 등록 필요) |
|
||||
|
||||
## Linode 설정
|
||||
|
||||
| 항목 | 값 |
|
||||
|------|-----|
|
||||
| 라벨 | zlambda |
|
||||
| ID | 47271589 |
|
||||
| 타입 | g6-standard-1 (1 vCPU, 2GB RAM, 50GB SSD) |
|
||||
| 리전 | ap-northeast (Tokyo, lish-tokyo2) |
|
||||
| 공인 IP | 139.162.71.52 |
|
||||
| Configuration profile | "NixOS Direct Disk" (id 99124808) |
|
||||
| Kernel | `linode/direct-disk` ← Linode emulated GRUB은 NixOS grub.cfg를 못 읽어서 변경 |
|
||||
| 디스크 sda | 121448048, ext4, 50688 MB → / |
|
||||
| 디스크 sdb | 121448049, swap, 512 MB → swap |
|
||||
| Linode Firewall | id 691875 "zlambda" — TCP22(any), TCP80/443(Cloudflare), UDP41641(any), ICMP(any), default DROP |
|
||||
| Linode API token | Vault `secret/cloud/linode` (netbis 계정용) |
|
||||
|
||||
## 디스크 레이아웃
|
||||
|
||||
```
|
||||
sda (49.5G)
|
||||
├── sda1 (1M) BIOS boot partition (EF02)
|
||||
└── sda2 (49.5G) ext4, mountpoint /
|
||||
sdb (512M)
|
||||
└── sdb1 (510M) swap
|
||||
```
|
||||
|
||||
GRUB은 BIOS-GPT 방식, sda MBR + BIOS boot partition + /boot inside / fs.
|
||||
|
||||
## NixOS Configuration
|
||||
|
||||
**Gitea 저장소**: https://gitea.inouter.com/kaffa/nixos-infra (private)
|
||||
|
||||
```
|
||||
nixos-infra/
|
||||
├── README.md
|
||||
├── .gitignore
|
||||
├── flake.nix # disko + nixpkgs 25.05
|
||||
├── flake.lock # 잠긴 input 버전
|
||||
├── configuration.nix # 메인 설정
|
||||
└── hardware-configuration.nix # nixos-anywhere가 자동 생성
|
||||
```
|
||||
|
||||
**clone 위치**:
|
||||
- kaffa-macmini: `~/nixos-infra/` (작성/수정용, push 권한). remote는 토큰 임베드 https URL
|
||||
- zlambda: `/root/nixos-infra/` (실제 빌드/적용용). remote는 SSH (`git@gitea.inouter.com:kaffa/nixos-infra.git`), gitea repo deploy key 등록됨 (`/root/.ssh/gitea_nixos_infra`, read-only, fingerprint `SHA256:Amz8LUDKHU59qxyMS48hfoP+KxRE/o6CITfkXzkAFNU`)
|
||||
- macbookair: 아직 clone 안 함 (필요 시 `git clone https://gitea.inouter.com/kaffa/nixos-infra.git`)
|
||||
|
||||
향후 두 번째 NixOS 노드 추가 시 `hosts/<name>/` 구조로 재편 예정 (README.md 참조).
|
||||
|
||||
flake input:
|
||||
- nixpkgs: `github:NixOS/nixpkgs/nixos-25.05`
|
||||
- disko: `github:nix-community/disko`
|
||||
|
||||
활성화된 모듈/서비스:
|
||||
- `networking.hostName = "zlambda"`
|
||||
- `services.openssh` (PermitRootLogin prohibit-password, PasswordAuth off)
|
||||
- `services.tailscale.enable = true`
|
||||
- `virtualisation.docker.enable = true` (autoPrune 켜짐)
|
||||
- `virtualisation.oci-containers.backend = "docker"` (`apisix.nix` 모듈에서 apisix + apisix-etcd 선언)
|
||||
- `nix.settings.experimental-features = [ "nix-command" "flakes" ]`
|
||||
- 패키지: vim git curl wget htop tmux jq rsync
|
||||
- TZ: Asia/Tokyo, locale en_US.UTF-8
|
||||
- `networking.firewall.enable = false` (Linode firewall에 일임)
|
||||
- `system.stateVersion = "25.05"`
|
||||
|
||||
`apisix.nix` 모듈 요약:
|
||||
- 컨테이너: apisix(172.22.222.20), apisix-etcd(172.22.222.3), docker network `apisix-net` (172.22.222.0/24)
|
||||
- 포트: 80→9080, 443→9443, 9180(admin)
|
||||
- 데이터: etcd는 `/var/lib/apisix/etcd` bind mount, apisix 로그는 named volume `apisix-logs`
|
||||
- config.yaml은 **템플릿(Nix store) + 런타임 렌더링(`apisix-render-config.service`) → `/run/apisix/config.yaml`** 후 read-only bind mount. admin key는 자리표시자 `__ADMIN_KEY__`로 들어있고 render 서비스가 agenix 복호화 값으로 sed 치환.
|
||||
- systemd 의존성: `init-apisix-net.service`(oneshot network 생성) → `docker-apisix-etcd`; `apisix-render-config.service`(oneshot) + `init-apisix-net.service` → `docker-apisix`
|
||||
- 시크릿: agenix(`secrets/apisix-admin-key.age`) → activation 시 `/run/agenix/apisix-admin-key`로 복호화. zlambda host ed25519 키와 kaffa 사용자 ed25519 키 두 개로 암호화됨.
|
||||
- 상세 운영: [[netbis]]
|
||||
|
||||
**커널 / sysctl 튜닝** (2026-04-08 추가):
|
||||
- `boot.kernelModules = [ "br_netfilter" ]` (docker bridge sysctl 활성화용)
|
||||
- 네트워크: BBR + fq qdisc, somaxconn 4096, tcp_fin_timeout 15, tcp_tw_reuse, tcp_keepalive 600/30/6, netdev_max_backlog 16384, tcp_max_syn_backlog 8192
|
||||
- 포워딩: ip_forward, IPv6 forwarding, bridge-nf-call-{ip,ip6}tables (docker)
|
||||
- 메모리: vm.swappiness=10, vm.overcommit_memory=1, vm.dirty_ratio=10/5
|
||||
- 파일/inotify: file-max=1048576, inotify watches=524288, instances=8192, queued_events=65536
|
||||
- 콘솔: kernel.printk = "3 4 1 3"
|
||||
|
||||
GRUB 설정: disko의 EF02 파티션이 자동으로 grub.devices를 채워주므로 `boot.loader.grub.devices`는 명시하지 않음 (명시하면 mirroredBoots 중복 오류 남).
|
||||
|
||||
### 재배포/변경 방법
|
||||
|
||||
**1. 호스트에서 직접 rebuild (권장, 가장 빠름)**
|
||||
|
||||
```fish
|
||||
# kaffa-macmini에서 변경
|
||||
cd ~/nixos-infra
|
||||
$EDITOR configuration.nix
|
||||
git add -A && git commit -m "..." && git push
|
||||
|
||||
# zlambda에서 적용 (deploy key 자동 인증)
|
||||
ssh root@zlambda
|
||||
cd /root/nixos-infra
|
||||
git pull
|
||||
nixos-rebuild switch --flake .#zlambda
|
||||
```
|
||||
|
||||
**2. macOS에서 원격 rebuild는 권장하지 않음**
|
||||
|
||||
macOS는 aarch64-darwin이라 x86_64-linux용 nixos-rebuild 래퍼를 native build 못 함.
|
||||
시도하면 cross-build 단계에서 실패하거나 한참 걸림. 대신 호스트에서 직접 rebuild 권장.
|
||||
필요 시 kaffa-macmini에 linux-builder VM을 켜면 가능.
|
||||
|
||||
**3. nixos-anywhere로 처음부터 재설치 (디스크 wipe)**
|
||||
|
||||
```fish
|
||||
cd ~/nixos-infra
|
||||
nix run github:nix-community/nixos-anywhere -- \
|
||||
--flake .#zlambda --build-on remote \
|
||||
root@139.162.71.52
|
||||
```
|
||||
|
||||
## 후속 작업
|
||||
|
||||
- [ ] [[vault]] SSH CA에 새 호스트키 등록 (vault.md 참조)
|
||||
- [ ] 필요 시 [[netbis]] APISIX/etcd Docker compose 재배포
|
||||
- [ ] 필요 시 [[searxng]]용 tlsproxy/microsocks 재배포
|
||||
Reference in New Issue
Block a user