A kubectl
plugin to visualize network policies rules.
-
Prints all network policies rules for the current namespace
kubectl np-viewer
-
Prints all network policies rules for a specific namespace
kubectl np-viewer -n default
-
Prints all network policies rules for all namespaces
kubectl np-viewer --all-namespaces kubectl np-viewer -A
-
Prints network policies rules of type ingress for the current namespace
kubectl np-viewer -i
-
Prints network policies rules of type egress for the current namespace
kubectl np-viewer -e
-
Prints network policies rules affecting a specific pod in the current namespace
kubectl np-viewer -p pod-name
There are several ways to install np-viewer
. The recommended installation is via the kubectl
plugin manager
called krew
.
Krew is a kubectl
plugin manager. If you have not yet installed krew
, get it at
https://github.com/kubernetes-sigs/krew.
Then installation is as simple as
kubectl krew install np-viewer
The plugin will be available as kubectl np-viewer
, see doc/USAGE for further details.
curl -L -o kubectl-np-viewer.gz https://github.com/runoncloud/kubectl-np-viewer/releases/download/v1.0.6/kubectl-np-viewer_darwin_amd64.tar.gz && \
tar zxvf kubectl-np-viewer.gz && chmod +x kubectl-np-viewer && mv kubectl-np_viewer $GOPATH/bin/
curl -L -o kubectl-np-viewer.gz https://github.com/runoncloud/kubectl-np-viewer/releases/download/v1.0.6/kubectl-np-viewer_linux_amd64.tar.gz && \
gunzip kubectl-np-viewer.gz && chmod +x kubectl-np-viewer && mv kubectl-np_viewer $GOPATH/bin/
https://github.com/runoncloud/kubectl-np-viewer/releases/download/v1.0.6/kubectl-np-viewer_windows_amd64.zip
Note that the file name in the GOPATH should be kubectl-np_viewer
if you want to be able to use it with kubectl
Requirements:
- go 1.13 or newer
- GNU make
- git
make bin # binaries will be placed in bin/