Skip to content

CLI and kubectl plugin to manage Kubernetes and Cilium networkPolicies

License

Notifications You must be signed in to change notification settings

MarcAntoineRaymond/netpol-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Release

Go Report Card OpenSSF Scorecard Go lint, test and gosec

Netpol-manager is tool to list Kubernetes Network policy and filter them based on which pods they apply to.

This tool support Cilium network policy and aggregate the different policies kinds in one output. Kinds can be filtered out using -k.

It can be used as a kubectl plugin.

Getting Started 🚀

Download and copy binary in your PATH:

mv kubectl-netpol /usr/local/bin/

Run kubectl using the new command:

kubectl netpol --help
kubectl netpol get -A

Sample with testpolicies:

# Show all networkpolicies in all namespaces of all kinds (classic network policies and cilium kinds) that apply to pods with label app.kubernetes.io/name=test
kubectl netpol get -A -p app.kubernetes.io/name=test --show-kind
┌────────────────────────────────┬────────────────┬───────────────────────────────┬─────────────────────────────┬────────────────────────┬───────────────┬────────────────────────┬──────────────┐
│              KIND              │   NAMESPACE    │             NAME              │        POD-SELECTOR         │        INGRESS         │ INGRESS-PORTS │         EGRESS         │ EGRESS-PORTS │
├────────────────────────────────┼────────────────┼───────────────────────────────┼─────────────────────────────┼────────────────────────┼───────────────┼────────────────────────┼──────────────┤
│ CiliumNetworkPolicy            │ authentication │ untitled-policy-cilium        │ <none>                      │ kube-system/app=back   │ UDP/443       │ kube-system/app=back   │ UDP/443      │
│                                │                │                               │                             │ security/app=test      │ TCP/8080      │ security/app=test      │ ANY/8080     │
│                                │                │                               │                             │ cert-manager/app=front │               │ cert-manager/app=front │              │
│                                │                │                               │                             ├────────────────────────┼───────────────┼────────────────────────┼──────────────┤
│                                │                │                               │                             │                        │               │ app=front              │ ANY/420      │
│                                │                │                               │                             │                        │               │                        │ TCP/80       │
├────────────────────────────────┼────────────────┼───────────────────────────────┼─────────────────────────────┼────────────────────────┼───────────────┼────────────────────────┼──────────────┤
│ CiliumClusterwideNetworkPolicy │ *              │ untitled-clusterpolicy-cilium │ app.kubernetes.io/name=test │ <defaultdeny>          │               │ kube-system/app=back   │ UDP/443      │
│                                │                │                               │                             │                        │               │                        │ TCP/8080     │
│                                │                │                               │                             ├────────────────────────┼───────────────┼────────────────────────┼──────────────┤
│                                │                │                               │                             │                        │               │ app=front              │ ANY/420      │
│                                │                │                               │                             │                        │               │                        │ TCP/80       │
└────────────────────────────────┴────────────────┴───────────────────────────────┴─────────────────────────────┴────────────────────────┴───────────────┴────────────────────────┴──────────────┘

About

CLI and kubectl plugin to manage Kubernetes and Cilium networkPolicies

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages