I created an istio mesh setup as per this guide.
Now my goal is to only allow access to product page service from the same namespace default, not from another namespace.
so I created the below AuthorizationPolicy
. If I apply only the first policy, it denies all requests very well from any namespace. But if you see the second policy, I only allowed the default namespace, still, it allowed access to product page service from another namespace.
Can you help me to find my configuration mistake?
apiVersion: security.istio.io/v1beta1
kind: AuthorizationPolicy
metadata:
name: productpage
namespace: default
spec:
selector:
matchLabels:
app: productpage
version: v1
---
apiVersion: security.istio.io/v1beta1
kind: AuthorizationPolicy
metadata:
name: productpage-all
namespace: default
spec:
selector:
matchLabels:
app: productpage
version: v1
action: ALLOW
rules:
- to:
- operation:
ports: ["9080"]
- from:
- source:
namespaces: ["default"]