# Egress 테스트 — mesh-client → sidecar → egressgateway(SNI passthrough) → api.lab.external # # 20-egress/dual-gateway/10-passthrough.yaml(가동 검증된 사내 채택 패턴)의 복제. # 차이: 전용 gateway(egw-pt) 대신 공용 istio-egressgateway(istio-system)를 쓴다 — # 폐쇄망 첫 검증은 "추가 gateway 배포 없이" 시작하는 게 반입 부담이 적다. # # 주의(destination FQDN): VS/DR의 destination host는 cluster.local 고정이다. # Istio 내부 service registry가 kubelet clusterDomain과 무관하게 *.svc.cluster.local로 # 등록하기 때문 — pod의 dnsConfig searches(__CLUSTER_DOMAIN__)와 별개 축이다. # (커스텀 도메인 클러스터 homelab.local에서 cluster.local destination으로 가동 실측됨) --- # SE — api.lab.external을 mesh registry에 등록. 이게 있어야: # (a) REGISTRY_ONLY(65-*) 아래에서도 이 호스트만 허용되고 # (b) gateway가 나갈 때 STRICT_DNS cluster(endpoint=fake-dns A레코드)로 LB한다. apiVersion: networking.istio.io/v1beta1 kind: ServiceEntry metadata: name: api-ext namespace: lab-apps spec: exportTo: - "." # client sidecar - "istio-system" # egress gateway — 이 둘 밖으로 노출 금지(mesh 전역 오염 방지) hosts: - api.lab.external ports: - number: 443 name: tls protocol: TLS # protocol TLS 라야 tls.sniHosts 라우팅이 붙는다(TCP면 SNI 못 봄) location: MESH_EXTERNAL resolution: DNS # STRICT_DNS — A record 전체를 endpoint로 펼침(복수 IP 안전) --- # Gateway 리소스는 gateway workload와 같은 ns(istio-system)에 둔다 # (PILOT_SCOPE_GATEWAY_TO_NAMESPACE 대비 — dual-gateway 랩과 동일 규율). apiVersion: networking.istio.io/v1beta1 kind: Gateway metadata: name: lab-egress namespace: istio-system spec: selector: istio: egressgateway servers: - port: number: 443 name: tls protocol: TLS hosts: - api.lab.external tls: mode: PASSTHROUGH # 복호화 없음 — 앱 TLS end-to-end, gateway는 SNI 라우팅만 --- # (1) client sidecar -> egressgateway (mesh route, lab-apps에만 노출) apiVersion: networking.istio.io/v1beta1 kind: VirtualService metadata: name: api-ext-client namespace: lab-apps spec: exportTo: ["."] hosts: - api.lab.external gateways: - mesh tls: - match: - gateways: [mesh] port: 443 sniHosts: [api.lab.external] route: - destination: host: istio-egressgateway.istio-system.svc.cluster.local port: { number: 443 } --- # (2) egressgateway -> 외부 host (gateway route, istio-system에서만 관리) apiVersion: networking.istio.io/v1beta1 kind: VirtualService metadata: name: api-ext-gateway namespace: istio-system spec: exportTo: ["."] hosts: - api.lab.external gateways: - lab-egress tls: - match: - gateways: [lab-egress] port: 443 sniHosts: [api.lab.external] route: - destination: host: api.lab.external port: { number: 443 }