8.2. Connectivity mapping using the roxctl netpol connectivity map command
Connectivity mapping provides details on the allowed connections between different workloads based on network policies defined in Kubernetes manifests. You can visualize and understand how different workloads in your Kubernetes environment are allowed to communicate with each other according to the network policies you set up.
To retrieve connectivity mapping information, the roxctl netpol connectivity map command requires a directory path. This directory must contain your Kubernetes network policy, ANP, and BANP manifests. The command’s output details the connectivity within the analyzed Kubernetes resources.
8.2.1. Retrieving connectivity mapping information from a Kubernetes manifest directory 링크 복사링크가 클립보드에 복사되었습니다!
Retrieve connectivity mapping information from a Kubernetes manifest directory by using the roxctl netpol connectivity map command.
Procedure
To retrieve the connectivity mapping information, run the following command:
roxctl netpol connectivity map <folder_path> [flags]where:
<folder_path>-
Specifies the path to the folder, which can include sub-folders that contain YAML resources and network policies for analysis, for example,
netpol-analysis-example-minimal/. The command scans the entire sub-folder tree. Optionally, you can also specify parameters to modify the behavior of the command.
Expand 표 8.2. Example output src dst conn 0.0.0.0-255.255.255.255
default/frontend[Deployment]
TCP 8080
default/frontend[Deployment]
0.0.0.0-255.255.255.255
UDP 53
default/frontend[Deployment]
default/backend[Deployment]
TCP 9090
The output displays a table listing the allowed connectivity lines. Each line is composed of the following elements:
src- Represents the source endpoint.
dst- Represents the destination endpoint.
conn- Represents the permissible connectivity attributes.
An endpoint follows the format
namespace/name[Kind]. For example,default/backend[Deployment].-
Optional: To see which policies and rules are responsible for allowing or denying specific connections, you can use the
--explainoption with theroxctl netpol connectivity mapcommand. You can use the output to debug network policy configurations. For more information about understanding the explanation output, see "Retriving explanations".
8.2.2. Connectivity map output formats and visualizations 링크 복사링크가 클립보드에 복사되었습니다!
You can use various output formats, including txt, md, csv, json, and dot. The dot format is ideal for visualizing the output as a connectivity graph. It can be viewed using graph visualization software such as Graphviz tool, and extensions to VSCode. You can convert the dot output to formats such as svg, jpeg, or png using Graphviz, whether it is installed locally or through an online viewer.
8.2.3. Generating svg graphs from the dot output using Graphviz 링크 복사링크가 클립보드에 복사되었습니다!
Follow these steps to create a graph in svg format from the dot output.
Prerequisites
- Graphviz is installed on your local system.
Procedure
Run the following command to create the graph in
svgformat:$ dot -Tsvg connlist_output.dot > connlist_output_graph.svgThe following are examples of the dot output and the resulting graph generated by Graphviz: