IT/OS&Middleware

[os] eBPF

Hayley Shim 2023. 10. 29. 00:21

안녕하세요. eBPF 기술을 이해하고 공유하기 위해 작성한 글입니다.

 

2022 kubecon Cloud Native eBPF Day Hosted by CNCF 세션을 추가 업데이트했습니다.(2022.10.24)

What is eBPF?

Why eBPF?

  • hardware is hard to change

How is eBPF different from Lua or WA(Web Assembly)?

  • eBPF : designed specifically to be embedded into operating systems(Linux, Windows)
  • Lua/WA : designed to be embedded into web application

Where is eBPF used today?

OpenTelemetry or eBPF?

  • OpenTelemetry : toolkit for all things observability
  • metrics : eBPF is the natural option for OS metrics
  • message tracing : a distributed trace is hard, trace-id needs to be attached
  • profiling : eBPF has enabled a wave of low-overhead, system-wide continuous profilers(Pyroscope, Parca, Pixie)
Pixie

OpenTelemetry and eBPF : Better Together

  • OpenTelemetry Protocol (OTLP) specification describes the encoding, transport, and delivery mechanism of telemetry data between telemetry sources, intermediate nodes such as collectors and telemetry backends.
 

[참고] K8s 에서의 eBPF/XDP 기반 고성능 & 고가용성 NAT 시스템, NAVER 송인주 2020 DEVIEW

컨테이너 환경 IP ACL 문제

  • IP 주소로 ACL 을 관리하는 시스템에 접근하는 경우, 컨테이너 IP 변경으로 인해 접근이 불가능
  • 다수의 Pod * 다수의 타겟 간에 동기화 부담
  • 일부 Pod 이라도 ACL 이 전파되지 않으면 장애로 이어질 수 있음

컨테이너 환경 IP ACL 해결 솔루션

  • 컨테이너의 IP 변경, 타겟 시스템과 관계없이 ACL 에 접근이 가능한 시스템 구축 필요

Linux Netfilter

1. 네트워크 주소 변환 (NAT)

  • 네트워크 주소 (IP, Port) 를 변환하는 메커니즘

2. 패킷 선택 및 필터링 (iptables)

  • 이미 linux kernel 의 iptables/ipvs 기술로 SWLB 를 구축한 경험
  • 하지만 실제 서비스에서 운영 시 connection table 관리에 어려움이 있었음
  • 일부 서비스에서는 connection 과정의 지연에 매우 민감
  • NAT 를 iptables 로 제공할 시, 실 서비스를 위한 대용량 트래픽에 대해서 성능이 충분할까?

eBPF(extended Berkeley Packet Filter)

  • Kernel Layer 에서 동작하는 Bytecode 를 안전하게 동적으로 Kernel 에 Loading
  • Kernel Layer 에 동작하는 여러 Type 의 eBPF Program 을 제공
  • cilium : eBPF를 통해 traffice shifting, circuit break 기능을 제공하는 오픈소스

K8s eBPF/XDP NAT 시스템

  1. Pod 으로부터 오는 Packet 의 Network Address Translation
  2. User 가 NAT Custom Resource 를 생성
  3. NAT 를 수행할 Pod 정보를 업데이트
  4. NAT Daemon Pod 이 해당 Data 를 읽어 eBPF/XDP NAT 에 등록
  5. Pod NAT 간 Mapping 은 같은 K8s Namespace 에서만 가능
 

'IT > OS&Middleware' 카테고리의 다른 글

[os] 서버 OS 모니터링-Disk  (0) 2023.10.29
[os] 서버 OS 모니터링-Memory  (1) 2023.10.29
[os] 서버 OS 모니터링-CPU  (0) 2023.10.29