peer-authentication-default.yaml 파일 생성:
apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
name: default
namespace: istio-system
spec:
mtls:
mode: STRICT
적용:
kubectl apply -f peer-authentication-default.yaml
기존 DestinationRule 수정하여 TLS 강제 적용:
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: helloworld
spec:
host: helloworld
trafficPolicy:
tls:
mode: ISTIO_MUTUAL
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
적용:
kubectl apply -f destination-rule-helloworld-trafficpolicy.yaml
서비스 간 호출이 정상적으로 진행되면, mTLS로 암호화된 통신이 적용된 것이다.
(추가로 Kiali에서 "mTLS" 뱃지를 통해 시각적으로 확인할 수 있다.)