# ext-a / ext-b — "폐쇄망 밖 외부 HTTPS 서버"의 모사(50-dns-resolution/20-backends.yaml 변형). # # 50-dns 랩과의 결정적 차이: 여기는 **Kubernetes Service를 만들지 않는다.** # 왜: Service를 만들면 그 ClusterIP가 mesh service registry에 올라가고, 모든 sidecar에 # per-VIP 전용 리스너가 생긴다. SE 호스트(api.lab.external)가 그 VIP로 resolve되면 # L4(SNI passthrough) 경로에서 VIP 리스너가 0.0.0.0:443 캐치올보다 먼저 매치되어 # 트래픽이 SE cluster가 아닌 in-mesh 경로를 타 버린다 — curl은 200이라 무증상인 채로 # 실험이 무효가 되는 함정(50-dns 랩 작업D에서 실제로 밟음, pod IP 우회로 해결). # "서비스 디스커버리에 없는 외부 서버"라는 모사 취지에도 Service 없는 쪽이 충실하다. # # 대가: fake-dns의 A 레코드가 pod IP를 직접 가리키므로, pod 재시작 시 레코드가 낡는다. # → /hosts/addn 3줄 재기록으로 재동기화(README ⑤단계를 다시 실행). # # 서버 인증서(secret ext-tls, SAN=api.lab.external + blocked.lab.external)는 랩 사설 # CA(lab-ca)로 발급해 주입한다(README ①·②단계). 클라이언트는 ca.crt(ConfigMap lab-ca)로 # 검증 → 폐쇄망에서 공인 CA 없이 TLS 전 구간을 검증 포함으로 테스트한다. --- apiVersion: v1 kind: ConfigMap metadata: { name: ext-a-conf, namespace: lab-ext } data: default.conf: | server { listen 443 ssl; server_name api.lab.external; ssl_certificate /etc/nginx/tls/tls.crt; ssl_certificate_key /etc/nginx/tls/tls.key; default_type text/plain; location / { return 200 "ext-a\n"; } } --- apiVersion: v1 kind: ConfigMap metadata: { name: ext-b-conf, namespace: lab-ext } data: default.conf: | server { listen 443 ssl; server_name blocked.lab.external; ssl_certificate /etc/nginx/tls/tls.crt; ssl_certificate_key /etc/nginx/tls/tls.key; default_type text/plain; location / { return 200 "ext-b\n"; } } --- apiVersion: apps/v1 kind: Deployment metadata: { name: ext-a, namespace: lab-ext, labels: { app: ext-a } } spec: replicas: 1 selector: { matchLabels: { app: ext-a } } template: metadata: labels: { app: ext-a } spec: containers: - name: nginx image: docker.io/library/nginx:1.27-alpine ports: [{ containerPort: 443 }] volumeMounts: - { name: conf, mountPath: /etc/nginx/conf.d/default.conf, subPath: default.conf } - { name: tls, mountPath: /etc/nginx/tls, readOnly: true } readinessProbe: tcpSocket: { port: 443 } initialDelaySeconds: 2 volumes: - name: conf configMap: { name: ext-a-conf } - name: tls secret: { secretName: ext-tls } --- apiVersion: apps/v1 kind: Deployment metadata: { name: ext-b, namespace: lab-ext, labels: { app: ext-b } } spec: replicas: 1 selector: { matchLabels: { app: ext-b } } template: metadata: labels: { app: ext-b } spec: containers: - name: nginx image: docker.io/library/nginx:1.27-alpine ports: [{ containerPort: 443 }] volumeMounts: - { name: conf, mountPath: /etc/nginx/conf.d/default.conf, subPath: default.conf } - { name: tls, mountPath: /etc/nginx/tls, readOnly: true } readinessProbe: tcpSocket: { port: 443 } initialDelaySeconds: 2 volumes: - name: conf configMap: { name: ext-b-conf } - name: tls secret: { secretName: ext-tls }