본문 바로가기
학부연구생/학부연구생 실습

tetragon을 통해 nginx 메트릭 추출

by ㅇㅏ도 2024. 3. 19.

nginx 실행

  • nginx pod 실행 후 시뮬레이션 도구 돌려보기
  • pod가 제대로 실행되지 않을 경우, 오류 메세지 확인해서 알려주세요!
  • tetragon을 통해 메트릭이 추출되는지 확인

 

1. tetragon 실행 여부 확인

kubectl get pods -A

kubectl get pods -A 명령어를 통해 tetragon이 제대로 실행 중인지 확인

 

2. gedit raw_syscalls.yaml 명령어로 아래의 파일을 저장

gedit raw_syscalls.yaml

apiVersion: cilium.io/v1alpha1
kind: TracingPolicy
metadata:
  name: "raw-syscalls"
spec:
  tracepoints:
    - subsystem: "raw_syscalls"
      event: "sys_enter"
      # args: add both the syscall id, and the array with the arguments
      args:
        - index: 4
          type: "int64"

 

3. 해당 파일을 정책으로 실행

kubectl apply -f raw_syscalls.yaml

 

4. 해당 정책이 실행되었는지 확인

kubectl get tracingpolicies

 

 

5. kubectl exec -ti -n kube-system ds/tetragon -c tetragon -- tetra getevents -o compact 명령어를 통해 tetragon이 제대로 메트릭을 가져오는지 확인

sudo kubectl exec -it nginx -- bash	//라는 명령어로 새로운 cmd에서 pod 띄우기

 

 

 

6. kubectl exec -ti -n kube-system ds/tetragon -c tetragon -- tetra getevents -o compact --pods 파드이름 명령어를 통해 해당 pod에서 발생하는 메트릭을 제대로 가져오는지 확인

 

  • 이때, 다른 터미널을 열고 실행한 pod에 시뮬레이션 하는 도구를 실행해야지 메트릭이 나와요-!