Skip to content

Instantly share code, notes, and snippets.

@weinong
Created January 4, 2024 21:23
Show Gist options
  • Select an option

  • Save weinong/dbe4c651de398b574c938853733708b0 to your computer and use it in GitHub Desktop.

Select an option

Save weinong/dbe4c651de398b574c938853733708b0 to your computer and use it in GitHub Desktop.
network policy with cilium
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: deny-egress-to-imds
spec:
podSelector: {}
policyTypes:
- Egress
egress:
- to:
- ipBlock:
cidr: 0.0.0.0/0
except:
- 169.254.169.254/32
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
- podSelector:
matchLabels:
k8s-app: kube-dns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment