feat(bpf): detect DNS resolution failures via UDP/53 eBPF (#22)#201
Open
Anushreer22 wants to merge 21 commits into
Open
feat(bpf): detect DNS resolution failures via UDP/53 eBPF (#22)#201Anushreer22 wants to merge 21 commits into
Anushreer22 wants to merge 21 commits into
Conversation
|
🚀 First PR — welcome aboard! A few things to expect:
If you get stuck, reply here or jump to Discussions. We want this PR to land. |
- Converted 7 event decode tests to table-driven style - Added exact size, short buffer, and oversized buffer cases - Merged TestDecodeSyscallEventTooShort into the table - All tests pass with t.Parallel() Signed-off-by: Anushree R <anushreer695@gmail.com>
- internal/bpf/c/dns_monitor.c: eBPF program hooking sys_enter_sendmsg + sys_enter_recvmsg, filtering port 53, tracking latency via dns_inflight map - internal/bpf/dns_monitor.go: Go loader with go:build ebpf tag - internal/bpf/gen_stub.go: dnsMonitorObjects stub for non-ebpf builds - internal/bpf/events.go: DNSEvent struct + DNSEventType constants - internal/bpf/loader.go: EventDNSMonitor = 8 - internal/collector/dns.go: DNSCollector with 5s failure reaper - internal/collector/signals.go: DNSSnapshot + DNSConsumerEntry types - internal/doctor/rules.go: dns_high_latency + dns_failure_rate rules - internal/chaos/dns.go: dns-flood chaos scenario Closes optiqor#22
48baa58 to
8793161
Compare
Signed-off-by: Anushree R <anushreer695@gmail.com>
Signed-off-by: Anushree R <anushreer695@gmail.com>
…param lint Signed-off-by: Anushree R <anushreer695@gmail.com>
…ther loaders Signed-off-by: Anushree R <anushreer695@gmail.com>
Signed-off-by: Anushree R <anushreer695@gmail.com>
Signed-off-by: Anushree R <anushreer695@gmail.com>
Signed-off-by: Anushree R <anushreer695@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements DNS visibility for Kerno — the #2 silent killer on Kubernetes.
Adds an eBPF program that hooks sendmsg/recvmsg syscalls filtered to UDP
port 53, measures per-pod DNS latency and failure rates token-by-token,
and fires doctor rules when CoreDNS is slow or dropping queries.
Files Changed
internal/bpf/c/dns_monitor.cinternal/bpf/dns_monitor.gointernal/bpf/gen_stub.gointernal/bpf/events.gointernal/bpf/loader.gointernal/collector/dns.gointernal/collector/signals.gointernal/doctor/rules.gointernal/chaos/dns.goDoctor Rules
dns_high_latencydns_failure_rateHow It Works
sys_enter_sendmsg— records send timestamp indns_inflightmap keyed by(pid, query_id)sys_enter_recvmsg— emits recv event; userspace looks up send timestamp to compute latencyAcceptance Criteria
dns_high_latency: P99 > 100ms = WARNING, > 500ms = CRITICALdns_failure_rate: > 1% = WARNING, > 5% = CRITICALkerno chaos --induce dns-floodpairs withdns_high_latencyrulegen_stub.goso non-ebpf builds compile cleanlyTesting
Closes #22