Skip to content

Instantly share code, notes, and snippets.

@owensengoku
Created March 16, 2023 03:50
Show Gist options
  • Save owensengoku/7e8cf83f44b8798f84109b63574580ef to your computer and use it in GitHub Desktop.
Save owensengoku/7e8cf83f44b8798f84109b63574580ef to your computer and use it in GitHub Desktop.
network-policy-sample.yaml
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: test-network-policy
namespace: default #You can specify the namespace by your requirement
spec:
podSelector: {} # Means select all
policyTypes:
- Egress
egress:
- to:
- ipBlock:
cidr: 10.0.0.0/24 #The cidr allowed to go
ports:
- protocol: TCP
port: 5978 #The port allowed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment