diff --git a/infra/apisix.md b/infra/apisix.md index 28f3734..0d9ce8d 100644 --- a/infra/apisix.md +++ b/infra/apisix.md @@ -1,6 +1,6 @@ --- title: APISIX 설정 및 운영 -updated: 2026-03-25 +updated: 2026-03-26 --- ## 아키텍처 @@ -19,7 +19,8 @@ updated: 2026-03-25 - etcd: incus-jp1 db 프로젝트 `etcd-1` (10.253.102.11:2379), prefix `/apisix-sandbox` - 설정 파일: `/opt/apisix/` (config.yaml, docker-compose.yml) - 모드: stream only (HTTP proxy 비활성화, 9080 미사용) -- 방화벽: 2201-2299/tcp만 개방, SSH는 Tailscale 경유 +- 방화벽: 2201-2299/tcp + 443/tcp 개방, SSH는 Tailscale 경유 +- 443 → iptables REDIRECT → 8443 (privileged 포트 우회) - 2026-03-17 AWS EC2에서 Lightsail nano($5/월)로 이전 #### 포트 포워딩 (stream_routes) @@ -27,6 +28,7 @@ updated: 2026-03-25 | 포트 | 용도 | upstream | 비고 | |------|------|----------|------| | 2201 | inbest SSH | 10.100.1.158:22 | inbest 전용 SSH 포트, OpenWrt Tailscale 광고 경유 | +| 8443 (외부 443) | Teleport | 192.168.9.52:443 | K3s MetalLB → Teleport proxy, iptables 443→8443 리다이렉트 | ### 오사카 (apisix-osaka) ``` @@ -39,7 +41,7 @@ BunnyCDN(inouter, ID 5316471) → apisix-osaka(172.233.93.180) → 백엔드 ### 서울 (K3s 새 클러스터, apisix 네임스페이스) — SafeLine WAF 전용 ``` -외부 → OpenWrt HAProxy(:9080/:9443) → NodePort(30233/31137, 3노드 roundrobin) → APISIX(replica 1) → K3s 서비스 +외부 → OpenWrt HAProxy(:9080/:9443) → MetalLB 192.168.9.50(80/443) → APISIX(replica 1) → K3s 서비스 ``` - 용도: SafeLine WAF 전용 리버스 프록시 (메인 라우팅은 Traefik으로 이전) - 클러스터: K3s 새 클러스터 (Supabase PostgreSQL 백엔드, kr2+kr1+hp2) @@ -47,10 +49,10 @@ BunnyCDN(inouter, ID 5316471) → apisix-osaka(172.233.93.180) → 백엔드 - APISIX: 3.15.0-ubuntu - SafeLine WAF 연동: `plugin_attr.chaitin-waf` → `safeline-detector:8000` (10.43.253.244) - global_rules: `chaitin-waf` (mode: block) + `limit-req` (rate 20, burst 10) -- 서비스: apisix-gateway NodePort (80→9080, 443→9443, NodePort 30233/31137) +- 서비스: apisix-gateway LoadBalancer 192.168.9.50 (80→9080, 443→9443) - etcd: apisix-etcd StatefulSet (K3s 내부) - Admin API: `apisix-admin` ClusterIP :9180 (라우트/upstream/SSL 수동 관리) -- HAProxy: OpenWrt에서 :9080→30233, :9443→31137 (3노드 roundrobin) +- HAProxy: OpenWrt에서 :9080→192.168.9.50:80, :9443→192.168.9.50:443 (MetalLB) - 2026-03-25 메인 라우팅 역할을 Traefik으로 이전, APISIX는 SafeLine WAF 전용으로 축소 - Ingress Controller + Gateway API CRD 제거됨 (GatewayProxy 모드에서 ApisixRoute CRD 미지원, HTTPRoute에 플러그인 개별 적용 불가 문제) diff --git a/infra/metallb.md b/infra/metallb.md new file mode 100644 index 0000000..be16cfa --- /dev/null +++ b/infra/metallb.md @@ -0,0 +1,76 @@ +--- +title: MetalLB (K3s LoadBalancer) +updated: 2026-03-26 +tags: [infra, k3s, metallb, networking] +--- + +## 개요 + +K3s 클러스터에 LoadBalancer 타입 서비스를 제공하는 베어메탈 로드밸런서. +NodePort 난립 문제를 해결하기 위해 도입 (2026-03-26). + +## 배포 정보 + +| 항목 | 값 | +|------|-----| +| Namespace | metallb-system | +| Chart | metallb/metallb | +| Helm repo | https://metallb.github.io/metallb | +| 모드 | L2 Advertisement | +| IP 풀 | 192.168.9.50 - 192.168.9.59 (10개) | +| Speaker | DaemonSet (노드당 1개, 3개) | +| Controller | Deployment (1개) | + +## IP 할당 현황 + +| IP | Service | Namespace | Port | +|----|---------|-----------|------| +| 192.168.9.50 | apisix-gateway | apisix | 80, 443 | +| 192.168.9.51 | sshpiper | sshpiper | 2222 | +| 192.168.9.52 | teleport-cluster | teleport | 443 | + +## 설정 + +```yaml +# IPAddressPool +apiVersion: metallb.io/v1beta1 +kind: IPAddressPool +metadata: + name: default-pool + namespace: metallb-system +spec: + addresses: + - 192.168.9.50-192.168.9.59 + +# L2Advertisement +apiVersion: metallb.io/v1beta1 +kind: L2Advertisement +metadata: + name: default + namespace: metallb-system +spec: + ipAddressPools: + - default-pool +``` + +## 관리 명령 + +```bash +kubectl get ipaddresspool -n metallb-system # IP 풀 확인 +kubectl get l2advertisement -n metallb-system # L2 광고 확인 +kubectl get svc --all-namespaces -o wide | grep LoadBalancer # LB 서비스 목록 +``` + +## NodePort → LoadBalancer 이전 기록 (2026-03-26) + +| Service | Before (NodePort) | After (LoadBalancer) | +|---------|-------------------|---------------------| +| apisix-gateway | 30233, 31137 | 192.168.9.50 (80/443) | +| sshpiper | 31840 | 192.168.9.51 (2222) | +| teleport-cluster | ClusterIP → LB | 192.168.9.52 (443) | +| argocd-server | 30080, 30443 | ClusterIP (Traefik Ingress) | +| anvil/ssh-server | 30023 | ClusterIP (추후 통합) | +| ironclad/ssh-server | 30022 | ClusterIP (추후 통합) | +| ironclad/nginx | 30297 | ClusterIP (추후 Traefik) | + +HAProxy 백엔드도 NodePort → MetalLB IP로 변경 완료. diff --git a/infra/openwrt.md b/infra/openwrt.md index ecabcdf..ad01d88 100644 --- a/infra/openwrt.md +++ b/infra/openwrt.md @@ -27,8 +27,8 @@ maxconn: 20000 |----------|------|---------|------|------| | ft_http | :80 | bk_traefik_http | 3노드 :80 roundrobin | Traefik 메인 라우팅 | | ft_https | :443 | bk_traefik_https | 3노드 :443 roundrobin | Traefik 메인 라우팅 | -| ft_apisix_http | :9080 | bk_apisix_http | 3노드 :30233 roundrobin | APISIX SafeLine WAF | -| ft_apisix_https | :9443 | bk_apisix_https | 3노드 :31137 roundrobin | APISIX SafeLine WAF | +| ft_apisix_http | :9080 | bk_apisix_http | MetalLB 192.168.9.50:80 | APISIX SafeLine WAF | +| ft_apisix_https | :9443 | bk_apisix_https | MetalLB 192.168.9.50:443 | APISIX SafeLine WAF | 백엔드 노드: incus-kr2(192.168.9.135), incus-kr1(192.168.9.214), incus-hp2(192.168.9.134) diff --git a/infra/sshpiper.md b/infra/sshpiper.md index edcc38a..7feb3db 100644 --- a/infra/sshpiper.md +++ b/infra/sshpiper.md @@ -21,7 +21,7 @@ K3s 클러스터(kr3 컨텍스트)에 Helm으로 설치 (2026-03-26) | App | sshpiperd v1.5.0 | | Image | farmer1992/sshpiperd:v1.5.0 | | Plugin | kubernetes (CRD 기반) | -| Service | NodePort 2222 → 31840 | +| Service | LoadBalancer 192.168.9.51:2222 | | Helm repo | https://tg123.github.io/sshpiper-chart | ## 라우팅 구조 @@ -29,7 +29,7 @@ K3s 클러스터(kr3 컨텍스트)에 Helm으로 설치 (2026-03-26) Pipe CRD (`pipes.sshpiper.com/v1beta1`)로 사용자명 기반 라우팅: ``` -ssh jp1@호스트:31840 → root@incus-jp1(100.109.123.1:22) +ssh jp1@192.168.9.51 -p 2222 → root@incus-jp1(100.109.123.1:22) ``` ## 인증 방식 diff --git a/infra/teleport.md b/infra/teleport.md new file mode 100644 index 0000000..8a9b04d --- /dev/null +++ b/infra/teleport.md @@ -0,0 +1,61 @@ +--- +title: Teleport (접근 관리) +updated: 2026-03-26 +tags: [infra, teleport, k3s, security] +--- + +## 개요 + +Gravitational Teleport — SSH/K8s/웹앱 접근 관리 플랫폼. + +## 배포 정보 + +K3s 클러스터(kr3 컨텍스트)에 Helm으로 설치 (2026-03-26) + +| 항목 | 값 | +|------|-----| +| Namespace | teleport | +| Chart | teleport/teleport-cluster 18.7.3 | +| App | Teleport 18.7.3 | +| Mode | standalone, multiplex | +| Proxy | LoadBalancer 192.168.9.52:443 | +| Auth | ClusterIP 3025/3026 | +| TLS | wildcard-inouter-tls (cert-manager) | +| Storage | Longhorn 5Gi | +| 클러스터명 | teleport.inouter.com | +| DNS | teleport.inouter.com → 52.79.45.166 (Cloudflare, proxied: false) | + +## 외부 접근 경로 + +``` +teleport.inouter.com (52.79.45.166) + → relay4wd:443 + → iptables REDIRECT :8443 + → APISIX stream_route (teleport) + → 192.168.9.52:443 (MetalLB) + → Teleport proxy Pod +``` + +## 사용자 + +| User | Roles | +|------|-------| +| admin | editor, access, auditor | + +## 관리 명령 + +```bash +# 사용자 목록 +kubectl exec -n teleport deploy/teleport-cluster-auth -- tctl users ls + +# 패스워드 리셋 +kubectl exec -n teleport deploy/teleport-cluster-auth -- tctl users reset + +# Helm 설정 +helm get values teleport-cluster -n teleport +``` + +## 관련 문서 + +- [[apisix]] — relay4wd stream_route로 Teleport 포워딩 +- [[sshpiper]] — SSH 리버스 프록시 (별도 서비스)