Skip to content

Instantly share code, notes, and snippets.

@nrobinaubertin
Created January 10, 2024 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nrobinaubertin/f583409700bced7edf03827d3fd48134 to your computer and use it in GitHub Desktop.
Save nrobinaubertin/f583409700bced7edf03827d3fd48134 to your computer and use it in GitHub Desktop.
k8s network policy to only allow internal networking
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-egress-to-internal
spec:
podSelector: {}
policyTypes:
- Egress
egress:
- to:
- ipBlock:
cidr: 10.0.0.0/8
- ipBlock:
cidr: 172.16.0.0/12
- ipBlock:
cidr: 192.168.0.0/16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment