--- WARNING: THIS IS AN AUTO-GENERATED FILE, DO NOT EDIT. PLEASE MODIFY THE ORIGINAL SOURCE IN THE 'https://github.com/istio/api' REPO source_repo: https://github.com/istio/api title: PeerAuthentication description: Peer authentication configuration for workloads. location: https://istio.io/docs/reference/config/security/peer_authentication.html layout: protoc-gen-docs generator: protoc-gen-docs schema: istio.security.v1beta1.PeerAuthentication aliases: [/zh/docs/reference/config/security/v1beta1/peer_authentication] number_of_entries: 3 ---
{{< warning >}} Development of PeerAuthentication is currently frozen and likely to be replaced in Ambient. {{< /warning >}} PeerAuthentication defines how traffic will be tunneled (or not) to the sidecar.
Examples:
Policy to allow mTLS traffic for all workloads under namespace foo
:
apiVersion: security.istio.io/v1
kind: PeerAuthentication
metadata:
name: default
namespace: foo
spec:
mtls:
mode: STRICT
For mesh level, put the policy in root-namespace according to your Istio installation.
Policies to allow both mTLS and plaintext traffic for all workloads under namespace foo
, but
require mTLS for workload finance
.
apiVersion: security.istio.io/v1
kind: PeerAuthentication
metadata:
name: default
namespace: foo
spec:
mtls:
mode: PERMISSIVE
---
apiVersion: security.istio.io/v1
kind: PeerAuthentication
metadata:
name: finance
namespace: foo
spec:
selector:
matchLabels:
app: finance
mtls:
mode: STRICT
Policy that enables strict mTLS for all finance
workloads, but leaves the port 8080
to
plaintext. Note the port value in the portLevelMtls
field refers to the port
of the workload, not the port of the Kubernetes service.
apiVersion: security.istio.io/v1
kind: PeerAuthentication
metadata:
name: default
namespace: foo
spec:
selector:
matchLabels:
app: finance
mtls:
mode: STRICT
portLevelMtls:
8080:
mode: DISABLE
Policy that inherits mTLS mode from namespace (or mesh) settings, and disables
mTLS for workload port 8080
.
apiVersion: security.istio.io/v1
kind: PeerAuthentication
metadata:
name: default
namespace: foo
spec:
selector:
matchLabels:
app: finance
mtls:
mode: UNSET
portLevelMtls:
8080:
mode: DISABLE
Mutual TLS settings.
Name | Description |
---|---|
UNSET |
Inherit from parent, if has one. Otherwise treated as |
DISABLE |
Connection is not tunneled. |
PERMISSIVE |
Connection can be either plaintext or mTLS tunnel. |
STRICT |
Connection is an mTLS tunnel (TLS with client cert must be presented). |