9.2. namespace を使用して strict mTLS モードを有効にする
PeerAuthentication で STRICT モードを有効にすることで、暗号化された mTLS トラフィックのみを受け入れるようにワークロードを制限できます。
namespace の PeerAuthentication ポリシーの例
apiVersion: security.istio.io/v1
kind: PeerAuthentication
metadata:
name: default
namespace: <namespace>
spec:
mtls:
mode: STRICT
auto mTLS が無効で、PeerAuthentication が STRICT モードに設定されている場合は、MUTUAL または ISTIO_MUTUAL モードで DestinationRule リソースを作成することにより、<namespace> 内のすべての宛先ホストに対して mTLS を有効化できます。
namespace の DestinationRule ポリシーの例
apiVersion: networking.istio.io/v1
kind: DestinationRule
metadata:
name: enable-mtls
namespace: <namespace>
spec:
host: "*.<namespace>.svc.cluster.local"
trafficPolicy:
tls:
mode: ISTIO_MUTUAL