kubectl config use-context cluster3-admin@cluster3# Check if there are any existing PeerAuthentication resources
kubectl get peerauthentication -n red
Create a PeerAuthentication resource to enforce STRICT mTLS mode in the red namespace:
kubectl apply -f - <<'EOF'
apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
name: default
namespace: red
spec:
mtls:
mode: STRICT
EOF# Check that PeerAuthentication was created
kubectl get peerauthentication -n red
kubectl exec -n red sleep-red -- curl -s http://echo-red.red.svc.cluster.local:8080/sun
{"pod_name":"sleep-red","version":"v1","namespace":"red"}kubectl run curl --image=curlimages/curl -- sleep 3600
kubectl exec curl -- curl -v -s http://echo-red.red.svc.cluster.local:8080/sun
* Host echo-red.red.svc.cluster.local:8080 was resolved.
* IPv6: (none)
* IPv4: 10.109.200.7
* Trying 10.109.200.7:8080...
* Established connection to echo-red.red.svc.cluster.local (10.109.200.7 port 8080) from 10.0.156.67 port 42556
* using HTTP/1.x
> GET /sun HTTP/1.1
> Host: echo-red.red.svc.cluster.local:8080
> User-Agent: curl/8.16.0
> Accept: */*
>
* Recv failure: Connection reset by peer
* closing connection #0
command terminated with exit code 56