Skip to content

Commit f00e1be

Browse files
committed
add help and polishing
1 parent f0e08e0 commit f00e1be

File tree

1 file changed

+65
-8
lines changed

1 file changed

+65
-8
lines changed

content/posts/2025-01-23-cli_whats_new_1.8.md

Lines changed: 65 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,45 @@ authors: [jpinsonneau]
1010

1111
![logo]({page.image('cli-whats-new-1-8/cli_logo.png')})
1212

13+
```
14+
------------------------------------------------------------------------
15+
_ _ _ _ ___ _ ___
16+
| \| |___| |_ ___| |__ ___ ___ _ ___ __ / __| | |_ _|
17+
| .' / -_) _/ _ \ '_ (_-</ -_) '_\ V / | (__| |__ | |
18+
|_|\_\___|\__\___/_.__/__/\___|_| \_/ \___|____|___|
19+
20+
------------------------------------------------------------------------
21+
```
22+
1323
Since we [introduced the Network Observability CLI](./2024-07-25-cli.md), numerous features have been added. This article will cover the improvements in version 1.8 and provide some concrete examples.
1424

1525
## New Options Available
1626
This update adds several options to the CLI, covering more scenarios and enabling scripting on top of the tool.
1727

18-
### Run in Background
28+
### Operate in the Background
1929
The `--background` option allows you to start a flow or packet capture without connecting your terminal to the collector pod. This enables you to let the capture run in the background while you work on something else. You can check the capture's progress using the `follow` command and copy the collector output locally using the `copy` command. Once the job is complete, you can `stop` or `cleanup` everything.
2030

21-
### Custom Namespace
31+
### Customizable Namespace
2232
You can now customize the capture namespace using the `NETOBSERV_NAMESPACE` environment variable. When the CLI starts, it automatically checks if this namespace exists and will stop if it finds any conflict with a pending capture. This is particularly useful if you want to run captures in parallel.
2333

2434
### Subnets Labelling
2535
The tool can now read configurations from `cluster-config-v1` and `network` to identify **Machine**, **Pods**, and **Services** subnets using the `--get-subnet` option. This will automatically add `SrcSubnetLabel` and `DstSubnetLabel` to your flows.
2636

27-
### YAML Output
37+
### YAML Configuration Output
2838
Outputting a `.yml` file instead of running the capture is now possible using the `--yaml` option. The file will contain all the resources needed to run the capture, such as the namespace, the agents embedding the pipeline and its configuration, and the related services. The collector will need to be run manually in parallel to start the capture.
2939

30-
## Advanced Filtering
40+
## Enhanced Data Filtering
3141
Filtering is crucial to gather precise network data without involving excessive resources and storage. The CLI focuses on this area, allowing you to deploy agents only where needed and fine-tune what's captured.
3242

33-
### NodeSelector
43+
### Assigning Agents to Nodes
3444
It's now possible to define agents `nodeSelector` to capture on a subset of nodes. You can rely on existing labels or create a dedicated one for this usage. For example, you can run:
3545
```sh
3646
`oc netobserv flows --node-selector=kubernetes.io/hostname:my-node
3747
```
3848
to run the agents on the node with the `kubernetes.io/hostname:my-node` label.
3949

4050
### eBPF Filters
41-
Agents recently introduced the ability to filter on IPs, Ports, Protocol, Action, TCPFlags, and more simultaneously. You can now apply these filters in the CLI as shown below:
51+
Agents recently introduced [the ability to filter](https://github.com/netobserv/netobserv-ebpf-agent/blob/main/docs/flow_filtering.md) on IPs, Ports, Protocol, Action, TCPFlags, and more simultaneously. You can now apply these filters in the CLI as shown below:
4252

4353
```sh
4454
netobserv flows \ # Capture flows
@@ -48,13 +58,13 @@ or --protocol=UDP # or UDP
4858

4959
You can add as many filters as you want and separate them by or to create multiple capture scenarios.
5060

51-
### Regular Expressions
61+
### Regular Expressions Usage
5262
If you need to filter on enriched content beyond the agent-level filters, you can use **regexes** to match any field/value pair. To filter all traffic from OpenShift namespaces, for example, you can use `--regexes=SrcK8S_Namespace~openshift.*`.
5363

5464
Regexes are comma-separated, so you can use multiple at once, such as `--regexes=SrcK8S_Namespace~my-ns,SrcK8S_Name~my-app`. Refer to the [flows format](https://github.com/netobserv/network-observability-operator/blob/main/docs/flows-format.adoc) to see the possible fields.
5565

5666
## Unified Collector UI
57-
Capturing packets now resembles flow capture, allowing you to live filter the content. This improvement was made possible by introducing the [flowlogs-pipeline](https://github.com/netobserv/flowlogs-pipeline) component inside eBPF agents, which parse packets and generate flows from them. All filtering capabilities are compatible with this approach!
67+
Capturing **packets** now resembles **flows** capture, allowing you to live filter the content. This improvement was made possible by introducing the [flowlogs-pipeline](https://github.com/netobserv/flowlogs-pipeline) component inside [eBPF agents](https://github.com/netobserv/netobserv-ebpf-agent), which parse packets and generate flows from them. All filtering capabilities are compatible with this approach!
5868

5969
## Metrics Capture on OpenShift
6070
Capturing metrics is now possible using the `metrics` command. This creates a `ServiceMonitor` to gather metrics from the agents and store them in [Prometheus](https://prometheus.io/). You can enable all or specific features to gather more information about your network, such in:
@@ -71,6 +81,53 @@ On top of the features, you can use all the filtering capabilities mentioned abo
7181
7282
![dashboard]({page.image('cli-whats-new-1-8/dashboard.png')})
7383
84+
## Help!
85+
86+
The help has been enhanced to provide examples for each command and option. You can type `oc netobserv help` for the general help message or request help on a specific command, such as `oc netobserv metrics help`, to get its options list.
87+
88+
```sh
89+
$ oc netobserv help
90+
91+
Netobserv allows you to capture flows, packets and metrics from your cluster.
92+
Find more information at: https://github.com/netobserv/network-observability-cli/
93+
94+
Syntax: netobserv [flows|packets|metrics|follow|stop|copy|cleanup|version] [options]
95+
96+
main commands:
97+
flows Capture flows information in JSON format using collector pod.
98+
metrics Capture metrics information in Prometheus using a ServiceMonitor (OCP cluster only).
99+
packets Capture packets information in pcap format using collector pod.
100+
101+
extra commands:
102+
cleanup Remove netobserv components and configurations.
103+
copy Copy collector generated files locally.
104+
follow Follow collector logs when running in background.
105+
stop Stop collection by removing agent daemonset.
106+
version Print software version.
107+
108+
basic examples:
109+
netobserv flows --drops # Capture dropped flows on all nodes
110+
netobserv packets --port=8080 # Capture packets on port 8080
111+
netobserv metrics --enable_all # Capture all cluster metrics with pktDrop, dns, rtt and network events features
112+
113+
advanced examples:
114+
Capture drops in background and copy output locally
115+
netobserv flows --background \ # Capture flows using background mode
116+
--max-time=15m \ # for a maximum of 15 minutes
117+
--protocol=TCP --port=8080 \ # either on TCP 8080
118+
or --protocol=UDP # or UDP
119+
netobserv follow # Display the progression of the background capture
120+
netobserv stop # Stop the background capture by deleting eBPF agents
121+
netobserv copy # Copy the background capture output data
122+
netobserv cleanup # Cleanup netobserv CLI by removing the remaining collector pod
123+
124+
Capture packets on specific nodes and port
125+
netobserv packets # Capture packets
126+
--node-selector=netobserv:true \ # on nodes labelled with netobserv=true
127+
--port=80 \ # on port 80 only
128+
--max-bytes=100000000 # for a maximum of 100MB
129+
```
130+
74131
## Feedback
75132
We hope you enjoyed this article!
76133

0 commit comments

Comments
 (0)