Created
February 10, 2025 16:09
-
-
Save daemonfire300/6c1204297f3c43903541cf6fb6fbbb78 to your computer and use it in GitHub Desktop.
same-ns-calico-pol.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: projectcalico.org/v3 | |
kind: NetworkPolicy | |
metadata: | |
name: allow-same-namespace-communication | |
namespace: my-namespace | |
spec: | |
selector: app == 'myapp' # Applies to pods with the label `app=myapp` | |
types: | |
- Ingress | |
- Egress | |
ingress: | |
- action: Allow | |
source: | |
selector: app == 'myapp' # Allow traffic from pods with the label `app=myapp` | |
namespaceSelector: projectcalico.org/name == 'my-namespace' # Restrict to the same namespace | |
egress: | |
- action: Allow | |
destination: | |
selector: app == 'myapp' # Allow traffic to pods with the label `app=myapp` | |
namespaceSelector: projectcalico.org/name == 'my-namespace' # Restrict to the same namespace |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment