Skip to content

Commit 841cae7

Browse files
committed
screens and commands
1 parent f00e1be commit 841cae7

File tree

5 files changed

+103
-4
lines changed

5 files changed

+103
-4
lines changed

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

Lines changed: 103 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,39 @@ This update adds several options to the CLI, covering more scenarios and enablin
2828
### Operate in the Background
2929
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.
3030

31+
```sh
32+
oc netobserv flows --background # Run a flow capture in the background
33+
34+
oc netobserv follow # Show current capture progression
35+
36+
oc netobserv stop # Stop the capture keeping the collector running
37+
38+
oc netobserv copy # Copy the output
39+
40+
oc netobserv cleanup # Remove all
41+
```
42+
3143
### Customizable Namespace
3244
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.
3345

46+
```sh
47+
NETOBSERV_NAMESPACE=my_ns oc netobserv [flows|packets|metrics|follow|stop|copy|cleanup]
48+
```
49+
3450
### Subnets Labelling
35-
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.
51+
The tool can now read configurations from `cluster-config-v1` and `network` to identify **Machine**, **Pods**, and **Services** subnets using the `--get-subnets` option. This will automatically add `SrcSubnetLabel` and `DstSubnetLabel` to your flows.
52+
53+
You will see subnets being configured during the creation of the agents:
54+
```sh
55+
creating flow-capture agents:
56+
opt: get_subnets, value: true
57+
Found subnets:
58+
Services: "172.30.0.0/16"
59+
Pods: "10.128.0.0/14"
60+
Machines: "10.0.0.0/16"
61+
```
62+
63+
![subnet labels]({page.image('cli-whats-new-1-8/subnets.png')})
3664

3765
### YAML Configuration Output
3866
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.
@@ -43,29 +71,56 @@ Filtering is crucial to gather precise network data without involving excessive
4371
### Assigning Agents to Nodes
4472
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:
4573
```sh
46-
`oc netobserv flows --node-selector=kubernetes.io/hostname:my-node
74+
oc netobserv flows --node-selector=kubernetes.io/hostname:my-node
4775
```
4876
to run the agents on the node with the `kubernetes.io/hostname:my-node` label.
4977

5078
### eBPF Filters
5179
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:
5280

5381
```sh
54-
netobserv flows \ # Capture flows
82+
oc netobserv flows \ # Capture flows
5583
--protocol=TCP --port=8080 \ # either on TCP 8080
5684
or --protocol=UDP # or UDP
5785
```
5886

87+
You will see filters being validated during the creation of the agents:
88+
```sh
89+
creating flow-capture agents:
90+
opt: filter_protocol, value: TCP
91+
opt: filter_port, value: 8080
92+
opt: add_filter
93+
opt: filter_protocol, value: UDP
94+
```
95+
96+
![filters]({page.image('cli-whats-new-1-8/filters.png')})
97+
5998
You can add as many filters as you want and separate them by or to create multiple capture scenarios.
6099

61100
### Regular Expressions Usage
62101
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.*`.
63102

103+
You will see regexes being validated during the creation of the agents:
104+
```sh
105+
creating flow-capture agents:
106+
opt: filter_regexes, value: SrcK8S_Namespace~openshift.*
107+
key: SrcK8S_Namespace value: openshift.*
108+
```
109+
110+
![regexes]({page.image('cli-whats-new-1-8/regexes.png')})
111+
64112
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.
65113

66114
## Unified Collector UI
67115
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!
68116

117+
Run a packet capture on a specitic port for example:
118+
```sh
119+
oc netobserv packets --port=80
120+
```
121+
122+
![packet capture]({page.image('cli-whats-new-1-8/packets.png')})
123+
69124
## Metrics Capture on OpenShift
70125
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:
71126
```sh
@@ -83,7 +138,7 @@ On top of the features, you can use all the filtering capabilities mentioned abo
83138

84139
## Help!
85140

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.
141+
The help has been enhanced to provide examples for each command and option. You can type `oc netobserv help` for the general help message:
87142

88143
```sh
89144
$ oc netobserv help
@@ -128,6 +183,50 @@ advanced examples:
128183
--max-bytes=100000000 # for a maximum of 100MB
129184
```
130185

186+
You can also request help on a specific command, such as `oc netobserv metrics help`, to get its options list:
187+
```sh
188+
$ oc netobserv metrics help
189+
190+
Netobserv allows you to capture metrics on your OCP cluster.
191+
Find more information at: https://github.com/netobserv/network-observability-cli/
192+
193+
Syntax: netobserv metrics [options]
194+
195+
features:
196+
--enable_all: enable all eBPF features (default: false)
197+
--enable_dns: enable DNS tracking (default: false)
198+
--enable_network_events: enable network events monitoring (default: false)
199+
--enable_pkt_translation: enable packet translation (default: false)
200+
--enable_pkt_drop: enable packet drop (default: false)
201+
--enable_rtt: enable RTT tracking (default: false)
202+
--enable_udn_mapping: enable User Defined Network mapping (default: false)
203+
--get-subnets: get subnets informations (default: false)
204+
205+
filters:
206+
--action: filter action (default: Accept)
207+
--cidr: filter CIDR (default: 0.0.0.0/0)
208+
--direction: filter direction (default: n/a)
209+
--dport: filter destination port (default: n/a)
210+
--dport_range: filter destination port range (default: n/a)
211+
--dports: filter on either of two destination ports (default: n/a)
212+
--drops: filter flows with only dropped packets (default: false)
213+
--icmp_code: filter ICMP code (default: n/a)
214+
--icmp_type: filter ICMP type (default: n/a)
215+
--node-selector: capture on specific nodes (default: n/a)
216+
--peer_ip: filter peer IP (default: n/a)
217+
--peer_cidr: filter peer CIDR (default: n/a)
218+
--port_range: filter port range (default: n/a)
219+
--port: filter port (default: n/a)
220+
--ports: filter on either of two ports (default: n/a)
221+
--protocol: filter protocol (default: n/a)
222+
--regexes: filter flows using regular expression (default: n/a)
223+
--sport_range: filter source port range (default: n/a)
224+
--sport: filter source port (default: n/a)
225+
--sports: filter on either of two source ports (default: n/a)
226+
--tcp_flags: filter TCP flags (default: n/a)
227+
--interfaces: interfaces to monitor (default: n/a)
228+
```
229+
131230
## Feedback
132231
We hope you enjoyed this article!
133232

88.3 KB
Loading
140 KB
Loading
93.6 KB
Loading
89.3 KB
Loading

0 commit comments

Comments
 (0)