$ oc edit flowcollector cluster
Learn how DNS resolution analysis uses eBPF-based decoding to identify service discovery issues and follow the steps to enable DNS tracking in the FlowCollector resource to enrich network flow records with domain names.
Use DNS resolution analysis to differentiate between network transport failures and service discovery issues by enriching eBPF flow records with domain names and status codes.
Standard flow logs only show that traffic occurred on port 53. DNS resolution analysis allows you to complete the following tasks:
Reduced Mean time to identify (Mtti): Distinguish immediately between a network routing failure and a DNS resolution failure, such as an NXDOMAIN error.
Measure internal service latency: Track the time it takes for CoreDNS to respond to specific internal lookups (e.g., my-service.namespace.svc.cluster.local).
Audit external dependencies: Audit which external APIs or third-party domains your workloads are communicating with without requiring sidecars or manual packet captures.
Improved security posture: Detect potential data exfiltration or Command and Control (C2) activity by auditing the Fully Qualified Domain Names (FQDNs) queried by internal workloads.
When this feature is active, the eBPF agent enriches the flow records. This metadata allows you to group and filter traffic by the intent of the connection (the domain) rather than just the source IP.
Enhanced DNS decoding allows the eBPF agent to inspect UDP and TCP DNS traffic on port 53 along with the query names for the DNS request.
Enable DNS tracking in the Network Observability Operator to monitor DNS query names, response codes, and latency for network flows within the cluster.
The Network Observability Operator is installed.
You have cluster-admin privileges.
You are familiar with the FlowCollector custom resource.
Edit the FlowCollector resource by running the following command:
$ oc edit flowcollector cluster
Configure the eBPF agent to enable the DNS tracking feature:
apiVersion: flows.netobserv.io/v1alpha1
kind: FlowCollector
metadata:
name: cluster
spec:
agent:
type: eBPF
ebpf:
features:
- DNSTracking
where:
spec.agent.type.ebpf.featuresSpecifies the list of features to enable for the eBPF agent. To enable DNS tracking, add DNSTracking to this list.
Save and exit the editor.
In the OKD web console, navigate to Observe → Network Traffic.
In the Traffic Flows view, click the Manage columns icon.
Ensure that the DNS Query Name, DNS Response Code, and DNS Latency columns are selected.
Filter the results by setting Port to 53.
Confirm that the flow table columns are populated with domain names and DNS metadata.
Identify metadata added to network flows, leverage DNS data for network optimization, and understand the performance and storage impacts on the cluster.
The following table describes the metadata fields added to network flows when DNS tracking is enabled.
|
Query names might be missing or truncated because of compression pointers or cache limitations. |
| Field | Description | Example |
|---|---|---|
|
The Fully Qualified Domain Name (FQDN) being queried. |
|
|
The status code returned by the DNS server. |
|
|
The transaction ID used to match queries with responses. |
|
Use the captured DNS metadata for the following operational outcomes:
Audit external dependencies: Ensure workloads are not reaching out to unauthorized external APIs or high-risk domains.
Performance tuning: Monitor DNS Latency to identify if CoreDNS pods require additional scaling or if upstream DNS providers are lagging.
A high frequency of NXDOMAIN responses typically indicates service discovery errors in application code or stale environment variables.
NXDOMAIN errors can be frequent in Kubernetes because of DNS searches on services and pods. While these results do not necessarily indicate a misconfiguration or broken URL, they can negatively impact performance.
When NXDOMAIN errors are returned despite an apparently valid Service or Pod host name, such as my-svc.my-namespace.svc, the resolver is likely configured to query DNS for different suffixes. You can optimize this by adding a trailing dot to fully qualified domain names to tell the resolver that the name is unambiguous.
For example, instead of https://my-svc.my-namespace.svc, use https://my-svc.my-namespace.svc.cluster.local. with a trailing dot.