# Test Report — Ingress / Egress Gateway 동작 검증 **Date:** 2026-06-07 **Cluster:** homelab (kubespray bare-metal, k8s v1.30.6, Calico) **Istio:** 1.30.0 (istiod + ingress/egress gateway, Helm 설치) **Scenario:** 10-ingress, 20-egress **NS:** mesh-test (istio-injection=enabled) --- ## 0. 사전 확인 - 메시 상태 정상: istiod/ingress/egress 모두 `1/1 Running`, proxy-status 2 proxies SYNCED. - ⚠️ 초기 "비정상" 의심은 **istioctl 1.27 클라이언트로 1.30 컨트롤플레인을 조회**한 버전 불일치 착시였음. 실제 이상 없음. - sample app(`httpbin`, `sleep`) READY 2/2 → sidecar 주입 정상. - 내부(sleep→httpbin) 200, 외부(httpbin.org) 200(기본 `outboundTrafficPolicy: ALLOW_ANY`). --- ## 1. Ingress Gateway ### 적용 manifest - `scenarios/10-ingress/gateway-ingress.yaml` — Gateway(selector `istio: ingressgateway`), HTTP:80 + HTTPS:443(TLS termination, `credentialName: httpbin-tls`), host `httpbin.example.com` - `scenarios/10-ingress/virtualservice-httpbin.yaml` — `/status*` 명시 매칭 + `/*` catch-all → `httpbin.mesh-test.svc:8000` - TLS secret: 자체서명 cert → `kubectl -n istio-system create secret tls httpbin-tls` (cert는 `tmp/certs/`, gitignored) ### 검증 (NodePort http 31080 / https 31443, NODE=203.0.113.212) | 테스트 | 명령 | 기대 | 실제 | |---|---|---|---| | HTTP catch-all | `curl -H "Host: httpbin.example.com" http://NODE:31080/get` | 200 | **200** | | path match | `.../status/418` | 418 | **418** | | TLS termination | `curl -k --resolve httpbin.example.com:31443:NODE https://.../get` | 200 | **200** | | host 분기 | `curl -H "Host: nope.example.com" .../get` | 404 | **404** | - `istioctl proxy-config routes deploy/istio-ingressgateway.istio-system` 에 `http.8080` / `https.443.*` route 반영 확인. - `istioctl analyze -n mesh-test` → 이슈 0. ### 합격 판정: PASS 외부→gateway 200, TLS termination 동작, host/path 라우팅 분기 정상. --- ## 2. Egress Gateway **패턴:** HTTPS SNI **PASSTHROUGH** (gateway는 복호화 없이 SNI만 보고 경유). 외부 대상 `httpbin.org:443`. ### 적용 manifest - `scenarios/20-egress/serviceentry-httpbin-ext.yaml` — httpbin.org:443 TLS, `MESH_EXTERNAL`, `resolution: DNS` - `scenarios/20-egress/gateway-egress.yaml` — Gateway(selector `istio: egressgateway`), 443 TLS `PASSTHROUGH` - `scenarios/20-egress/destinationrule-egress.yaml` — egress gateway subset `httpbin` - `scenarios/20-egress/virtualservice-egress.yaml` — 2단 라우팅(mesh→egress subset, egress→httpbin.org) ### 검증 | 항목 | 확인 방법 | 결과 | |---|---|---| | sleep proxy에 egress cluster | `proxy-config clusters deploy/sleep.mesh-test` | `...egressgateway...443 httpbin` subset cluster 존재 | | egress gateway listener | `proxy-config listeners deploy/istio-egressgateway` | `0.0.0.0:8443 SNI: httpbin.org → outbound|443||httpbin.org` | | 실제 호출 | `sleep -> curl -sI https://httpbin.org/get` | **HTTP/2 200** | | **경유 강제** | egress gateway access log 신규 라인 | `outbound|443||httpbin.org` 기록 (dest 44.213.156.185:443) | access log 발췌: ``` [2026-06-07T01:49:40Z] "- - -" 0 ... "44.213.156.185:443" outbound|443||httpbin.org 10.255.126.47:49456 10.255.126.47:8443 10.255.126.49:37006 httpbin.org - ``` (egress gateway pod IP 10.255.126.47:8443 수신 → 외부 httpbin.org 송신 = 경유 확인) ### 합격 판정: PASS (경유 강제 + 200) ### 미수행 (의도적 보류) - **REGISTRY_ONLY 차단 테스트**: `outboundTrafficPolicy`는 mesh 전역(istio configmap) 설정 → 메시 전체 영향. 위험 작업 정책상 사용자 승인 후 별도 진행 예정. 현재는 `ALLOW_ANY` 유지 상태에서 VirtualService 기반 경유만 검증. - TLS origination(평문→egress에서 TLS 시작): 본 검증은 passthrough 채택. 별도 시나리오로 분리. --- ## 3. 트러블슈팅 - `kubectl apply -f scenarios/00-sample-apps/`: 알파벳 순 처리로 `httpbin.yaml`이 `namespace.yaml`보다 먼저 적용되어 NotFound. **재적용(2회)으로 해결** — 디렉토리 apply 시 ns 선생성 의존성. (개선: `--server-side` 또는 ns 분리 적용 권장) --- ## 4. 재현 명령 요약 ```bash # 0. sample apps kubectl apply -f scenarios/00-sample-apps/ # ns 의존으로 2회 또는 ns 먼저 # 1. ingress kubectl -n istio-system create secret tls httpbin-tls --cert=tmp/certs/cert.pem --key=tmp/certs/key.pem kubectl apply -f scenarios/10-ingress/ NODE=203.0.113.212 curl -H "Host: httpbin.example.com" http://$NODE:31080/get # 2. egress kubectl apply -f scenarios/20-egress/ kubectl -n mesh-test exec deploy/sleep -c sleep -- curl -sI https://httpbin.org/get kubectl -n istio-system logs deploy/istio-egressgateway | grep httpbin.org ``` ## 5. 다음 작업 - REGISTRY_ONLY 전환 후 미등록 외부 차단 검증(승인 필요). - 30-security: PeerAuthentication STRICT + AuthorizationPolicy. - TLS origination egress 변형.