Interactive visualization tool for Kubernetes NetworkPolicy resources
Understand, analyze, and manage your Kubernetes network security with visual graphs
- Visual Graph Representation: Interactive visualization of NetworkPolicy connections with D3.js
- Direct Cluster Integration: Connect directly to your Kubernetes cluster to fetch policies
- Import Options: Upload YAML/JSON files or paste content directly
- Advanced Filtering: Filter by namespace, pod, policy type, or labels
- Comprehensive Details: View complete policy specifications with selectors, rules and ports
- Interactive Exploration: Hover, drag, zoom and click to explore the policy graph
- Cross-Policy Connections: Visualize how different policies interact with each other
- Node Deduplication: Option to combine identical selectors for cleaner visualization
- No External Dependencies: 100% client-side visualization with optional in-cluster deployment
# Clone the repository
git clone https://github.com/infnada/k8s-network-policy-visualizer.git
cd k8s-network-policy-visualizer
# Install dependencies
npm install
# Start development server
npm run dev
Visit http://localhost:3000 to use the application.
# Pull the image
docker pull ghcr.io/infnada/k8s-network-policy-visualizer:latest
# Run the container
docker run -p 3000:3000 ghcr.io/infnada/k8s-network-policy-visualizer:latest
Visit http://localhost:3000 to use the application.
# Add the Helm repository
helm repo add k8s-npv https://infnada.github.io/k8s-network-policy-visualizer
helm repo update
# Install the chart
helm install networkpolicy-visualizer k8s-npv/networkpolicy-visualizer
For more detailed deployment instructions, see DEPLOYMENT.md.
There are three ways to load NetworkPolicy resources:
- Load from Cluster: Connect directly to your cluster (requires appropriate RBAC permissions)
- Upload Files: Upload YAML or JSON files containing NetworkPolicy resources
- Paste YAML/JSON: Paste NetworkPolicy content directly into the application
Once loaded, you can:
- Zoom and Pan: Use mouse wheel to zoom and drag to pan the view
- Hover over Nodes/Links: View detailed information in tooltips
- Drag Nodes: Rearrange the layout to better visualize connections
- Policy Details: Click "Details" next to a policy name for complete information
- Filter Policies: Use the filtering options to focus on specific resources
- Change Theme: Toggle between light and dark themes
The visualization shows different types of resources:
- Blue Circles: Pod selectors
- Green Squares: Namespace selectors
- Orange Diamonds: IP Blocks
- Purple Diamonds: Combined namespace+pod selectors
- Red Lines: Ingress rules (traffic flowing in)
- Green Lines: Egress rules (traffic flowing out)
The application supports several configuration options:
Variable | Description | Default |
---|---|---|
PORT |
Port for the server to listen on | 3000 |
NODE_ENV |
Environment mode (production/development) | development |
KUBECONFIG |
Path to kubeconfig file (if not using in-cluster config) | `` |
See values.yaml for a complete list of configuration options.
The application consists of:
- Backend API: Node.js Express server that communicates with the Kubernetes API
- Frontend Application: React+D3.js application for interactive visualization
- Kubernetes Integration: Uses the official Kubernetes client for Node.js
The visualization process involves:
- Policy Parsing: Converting raw NetworkPolicy objects into graph data
- Graph Building: Creating a network graph with nodes and links
- Force Simulation: Using D3.js physics-based simulation for optimal layout
- Interactive Rendering: Adding user interaction and dynamic updates
- Cross-policy Analysis: Identifying connections between different policies
For technical details, see ARCHITECTURE.md.
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Run tests
npm test
This project is licensed under the MIT License - see the LICENSE file for details.
For information about security policies and procedures, see SECURITY.md.
- Export visualization as SVG/PNG
- Support for custom CRDs with similar network policy functionality
- Policy validation and recommendations
- Multi-cluster support
- Historical policy comparison
- Custom layout algorithms