2022.03. 한승호 📧 tmdgh663@gmail
📓 https://grizzled-yoke-68e.notion.site/Pixie-9c778eead02f42a5a17f2e58290257c5
1.1 Pixie 소개
1.2 아키텍처 소개
.png)
https://docs.pixielabs.ai/about-pixie/what-is-pixie/
1.3 BPF/eBPF 소개
Pixie는 eBPF를 사용하여 데이터 수집의 대부분을 수행합니다. eBPF를 쉽게 이해하기 위해서는 리눅스 네트워크 스택과 BPF에 대한 이해가 필요합니다. 쉬운 이해를 위해 KANS 스터디에서 제공해주신 내용을 공유합니다.
.png)
.png)
.png)
.png)
.png)
.png)
배포 및 Pixie 클라우드 연동
# Pixie CLI 설치
bash -c "$(curl -fsSL https://withpixie.ai/install.sh)"
> # 접근 토큰 입력 필요!
> # 접근 토큰은 Pixie 사이트에서 회원가입시 발급됩니다.
# Pixie 배포
px deploy --cluster_name eksworkshop-eksctl --pem_memory_limit=1Gi
클라우드 연동을 위해 Pixie 사이트로 접속하여 회원가입 후, 접근 토큰을 발급받아 등록합니다.

접근 토큰 등록 후, px cli 를 통해 pixie 배포!

pixie 배포 확인

pixie 배포 이후 pixie 사이트(https://work.withpixie.ai:443 )에서 대시보드 확인이 가능합니다.

MSA 샘플 예제 배포
# sock shop yaml 다운 및 배포
curl -O https://raw.githubusercontent.com/pixie-labs/pixie-demos/main/eks-workshop/complete-demo.yaml
kubectl apply -f complete-demo.yaml
# 배포 확인
kubectl get pods -n px-sock-shop
# sock shop 접속
export SERVICE_IP=$(kubectl -n px-sock-shop get svc front-end --template "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}")
echo http://$SERVICE_IP/


sock 접속 확인
.png)
eBPF를 사용한 Pixie 프로토콜 추적([https://docs.pixielabs.ai/about-pixie/pixie-ebpf/](https://docs.pixielabs.ai/about-pixie/pixie-ebpf/)).png)
클러스터 리소스 대시보드

노드 대시보드

파드 대시보드

노드 대시보드 내 애플리케이션 프로파일링 기능 제공 (C++, Go, Rust 언어만 지원)
네트워크 대시보드

DNS 플로우 대시보드

네트워크 플로우 대시보드

tcp drop 대시보드
net-filter 대시보드 

# Kafka 데모 MSA 예제 배포
px demo deploy px-kafka
#파드 확인
kubectl get pods -n px-kafka
Kafka 예제 Broker 목록
Kafka 대시보드
브로커, 생산자 및 소비자 포드 확인# helm 설치
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
# grafana repo 추가
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
# pixie 플러그인 추가
helm show values grafana/grafana > grafana_chart.yaml
vi grafana_chart.yaml
>>
.
.
.
## Additional grafana server volume mounts
# Defines additional volume mounts.
extraVolumeMounts: []
# - name: extra-volume-0
# mountPath: /mnt/volume0
# readOnly: true
# existingClaim: volume-claim
# - name: extra-volume-1
# mountPath: /mnt/volume1
# readOnly: true
# hostPath: /usr/shared/
## Pass the plugins you want installed as a list.
##
plugins:
- pixie-pixie-datasource # 추가
# - digrich-bubblechart-panel
# - grafana-clock-panel
.
.
.
# grafana 배포
helm install my-release grafana/grafana --values grafana_chart.yaml# 대시보드 접속
export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=my-release" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace default port-forward $POD_NAME 3000
# 로그인 정보
ID : admin
## Password 확인
kubectl get secret --namespace default my-release-grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
# Cluster ID 확인
px get viziers
# API Key 확인
px api-key create 입력 정보 연동까지 20분정도 걸립니다
Cluster ID 확인
Key 확인 
# Import Pixie's module for querying data.
import px
# Load data from Pixie's `http_events` table into a Dataframe.
df = px.DataFrame(table='http_events', start_time=__time_from)
# Bin the 'time_' column using the interval provided by Grafana.
df.timestamp = px.bin(df.time_, __interval)
# Group data by unique 'timestamp' and count the total number of
# requests per unique timestamp.
per_ns_df = df.groupby(['timestamp']).agg(
throughput_total=('latency', px.count)
)
# Calculate throughput by dividing # of requests by the time interval.
per_ns_df.request_throughput = per_ns_df.throughput_total / __interval
# Rename 'timestamp' column to 'time_'. The Grafana plugin expects a 'time_'
# column to display data in a Graph or Time series.
per_ns_df.time_ = per_ns_df.timestamp
per_ns_df.request_throughput = per_ns_df.request_throughput * 1e9
# Output select columns of the DataFrame.
px.display(per_ns_df['time_', 'request_throughput']) 
PxL 스크립트 입력 후 대시보드 연동 확인개인적으로 강력한 디버깅 기능을 제공하므로 매력적으로 느껴집니다. 하지만, 베타 버전으로 대시보드 회원 관리, 민감데이터 측면에서 한계가 존재합니다. 이 부분은 엔터프라이즈를 구매하면 해결할 수 있다고 생각합니다. 베타 버전을 운영 레벨로 사용함에 있어 버전 업데이트를 지켜봐야 하지만, 개발 레벨에서 디버깅 모니터링으로 활용하면 좋을 것 같습니다. 😀