Skip to content

Commit

Permalink
Update 07-allow-traffic-from-some-pods-in-another-namespace.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yanivpaz committed Mar 23, 2022
1 parent 8385bb1 commit 8b6334e
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion 07-allow-traffic-from-some-pods-in-another-namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ If you don't see a command prompt, try pressing enter.
/ # wget -qO- --timeout=2 http://web.default
wget: download timed out
(traffic blocked)
(traffic blocked)
Note: see remark below how to use OR in the network policy , so this example will work as well
```
Query this web server from `other` namespace, labelling the application `type=monitoring`, observe it is **allowed**:
Expand All @@ -93,6 +94,31 @@ If you don't see a command prompt, try pressing enter.
(traffic allowed)
```

## remarks
Please note that that example below is OR condition
```
ingress:
- from:
- namespaceSelector: # chooses all pods in namespaces labelled with team=opera
matchLabels:
team: operations
- podSelector: # chooses pods with type=monitoring
matchLabels:
type: monitoring
```

while this example is AND condition
```
ingress:
- from:
- namespaceSelector: # chooses all pods in namespaces labelled with team=opera
matchLabels:
team: operations
podSelector: # chooses pods with type=monitoring
matchLabels:
type: monitoring
```

## Cleanup

kubectl delete networkpolicy web-allow-all-ns-monitoring
Expand Down

0 comments on commit 8b6334e

Please sign in to comment.