慣性聚合 高效追蹤和閱讀你感興趣的部落格、新聞、科技資訊
閱讀原文 在慣性聚合中打開

推薦訂閱源

博客园 - 司徒正美
V
V2EX
T
Tailwind CSS Blog
有赞技术团队
有赞技术团队
aimingoo的专栏
aimingoo的专栏
Apple Machine Learning Research
Apple Machine Learning Research
IT之家
IT之家
Blog — PlanetScale
Blog — PlanetScale
A
About on SuperTechFans
月光博客
月光博客
T
The Blog of Author Tim Ferriss
宝玉的分享
宝玉的分享
Martin Fowler
Martin Fowler
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
V
Visual Studio Blog
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python)
從零開始學習eBPF:從eBPF虛擬機到編寫自己的工具(已在實際Cilium集群上測試)
Huỳnh Lê Nhấ · 2026-05-24 · via DEV Community

目前,在我所建立的 Kubernetes 集群的一個工作節點上,140 個 eBPF 程序正在 Linux 内核中運行 — 路由每一個封包,控制設備存取,收集指標。沒有人重新編譯過內核。沒有人載入過模組.

這句話就是我寫作 eBPF 從頭開始 的整個原因:一個免費的、22 章節系列,將引導你從"eBPF 虛擬機器到底是什麼"撰寫和載入你自己的 eBPF 程式 — 以 C 語言搭配 libbpf + CO-RE,以及從 Go 語言搭配 cilium/ebpf.

👉 免費閱讀(英文): https://kkloudtarus.net/en/blog/series/ebpf-from-scratch
💻 來源代碼: https://github.com/nghiadaulau/ebpf-from-scratch

是什麼讓它不同

  • 所有內容均在實際硬體上進行測試 — 一個運行核心版本 6.17Cilium 1.19 (無 kube-proxy, 數百個 BPF 程序運行) 的 Kubernetes 集群是整個實驗室。沒有模糊的圖表;我們分析正在實際運行的程序.
  • 基於官方文件 — ebpf.io, kernel.org, libbpf, cilium. 声明會被驗證,不是直覺感受.
  • 深入探討,不是表面 — 我們深入研究寄存器,驗證器的安全證明,JIT,映射,以及程序經歷的確切生命週期.
  • 它還是全雙語(英文 + 越南文).

快速品嚐 — 每個 eBPF 概念都是你可以 看到 在實際節點上:

sudo bpftool prog show id 2871

進入全螢幕模式 離開全螢幕模式

2871: sched_cls  name tail_no_service_ipv4  tag fe7bcb57c001d434  gpl
    xlated 4920B  jited 2778B  memlock 8192B  map_ids 171,631
    btf_id 758

進入全螢幕模式 離開全螢幕模式

xlated = 驗證器接受後的字節碼。jited = 原生機器碼。map_ids = 它如何保持狀態。這是eBPF,不在幻燈片上 — 正在運行。

你將學到(7部分,22章)

第一部分 — 基礎

  • eBPF 虛擬機:暫存器、指令集和位元碼
  • 驗證器:為何 eBPF 不會讓內核崩潰
  • 映射:記憶體和通往使用者空間的橋樑
  • 程式類型和鉤子:你掛載的位置、你看到的内容
  • BTF 和 CO-RE:一次編譯,跨所有內核執行

第二部分 — 追蹤

  • 從一行指令到映射、計數和直方圖
  • uprobe、USDT,以及從主機檢查Pod

第三部分 — 寫實際的工具

  • libbpf + CO-RE:自己寫一個eBPF工具(C)
  • cilium/ebpf:從Go載入eBPF

第四部分 — 網路

  • XDP:在最早期處理封包 — 寫一個防火牆
  • tc/sched_cls 和分析實時 Cilium 資料路徑
  • 自行編寫 tc 程序:__sk_buff 和 tcx 鏈接

第五部分 — 安全性

  • LSM BPF:在內核中實施安全性權限
  • seccomp-bpf:過濾每個容器的系統調用
  • Tetragon 方法:從觀察到實施,使用 bpf_send_signal

第六部分 — 可觀察性

  • 使用perf_event進行CPU剖析(火焰圖的基礎)
  • CPU離線與調度器延遲
  • 深入Hubble:從eBPF事件到整個集群的網絡流量

第七部分 — 結合使用

  • 案例研究:一個通過Cilium的eBPF數據路徑的封包
  • 總結:編寫connmon,一個節點範圍的TCP連接監控器

誰適合這個

後端 / 平台 / SRE / 安全人員,他們一直聽到「Cilium 用 eBPF 做這個」並且想真正理解——並 撰寫 這件事。你將需要對 Linux 命令列感到舒適;其他所有內容都是從零開始建立的。


如果你讀了任何內容,我真心希望得到回饋——什麼清晰,什麼不清晰。並且如果它有用,請在repo 很有用。

從這裡開始→ https://kkloudtarus.net/en/blog/series/ebpf-from-scratch