Istio 安全层详解 | AI生成和翻译

Home 2026.01

这些是 Kubernetes 环境中使用的三种不同但互补的安全机制,尤其是在涉及 Istio 时。以下是清晰的分解:

1. Kubernetes NetworkPolicy (L3/L4 网络级访问控制)

2. Istio AuthorizationPolicy (L7/应用级授权 + 身份感知)

3. mTLS (mutual TLS) in Istio

Relationship and Best Practice Summary

特性 Kubernetes NetworkPolicy Istio AuthorizationPolicy Istio mTLS
Layer L3/L4 L7 L4 (transport) + identity
Enforced by CNI (Calico, Cilium, etc.) Envoy sidecar Envoy sidecar
Identity aware No Yes (via mTLS or JWT) Provides the identity
Encryption No No (relies on mTLS) Yes
HTTP path/method control No Yes No
Works outside mesh Yes No No
Recommended in Istio clusters Yes (defense in depth) Yes (primary L7 control) Yes (STRICT mode)
  1. 全局启用 Istio mTLS 在 STRICT 模式(通过 PeerAuthenticationDestinationRule)。
  2. 使用 Istio AuthorizationPolicy 作为细粒度访问控制的主要机制(谁可以调用哪个 API)。
  3. 保留 Kubernetes NetworkPolicy 用于:
    • 防御纵深。
    • 阻止绕过 mesh 的流量(例如 init containers、host networking pod、外部 ingress)。
    • 到外部服务的 egress 控制。

简而言之:
mTLS 提供加密 + 强大身份 → Istio AuthorizationPolicy 使用这些身份进行 L7 授权 → Kubernetes NetworkPolicy 添加额外的 L3/L4 安全网。

它们并不相互排斥 — 在生产 Istio 设置中,应一起使用所有三个。


Back

x-ai/grok-4.1-fast

Donate