본문 바로가기

DevOps & Cloud

4. Hubble

728x90
반응형

연구실 프로젝트 Season1 Ep4

 

https://docs.cilium.io/en/v1.10/gettingstarted/hubble_setup/

 

Setting up Hubble Observability — Cilium 1.10.18 documentation

In order to access the Hubble API, create a port forward to the Hubble service from your local machine. This will allow you to connect the Hubble client to the local port 4245 and access the Hubble Relay service in your Kubernetes cluster. For more informa

docs.cilium.io

cilium 공식 레퍼런스를 참고했다.

hubble은 반드시 수동으로 켜고 꺼야 한다.

hubble cli를 위를 참고해서 설치하면 hubble을 이용한 커맨드가 가능하다.

 

hubble enable이 작동하지 않을 때 명령어

 

cilium hubble enable --relay-image quay.io/cilium/hubble-relay:stable

 

반드시 실행후 포트포워드를 해줘야 한다.

 

cilium hubble port-forward&

 

hubble status 명령어의 경우 현재 상태를 확인 가능하다.

 

hubble observe

해당 명령어의 경우 flow API를 쿼리하고 흐름을 찾을 수도 있다.

 

1시간 동안 네트워크의 흐름을 json 형태로 저장하는 방법은 chat gpt에게 물어봤다.

 

timeout 10m hubble observe flows --output=jsonpb > flows.json

or

hubble query flows --start=-1h --output=jsonpb > flows.json

 

이것이다. 현재 테스트 중이라서 결과를 보고 다시 포스팅하겠다.

 

flows.json 파일을 확인해 본 결과 sock-shop의 로그 정보가 json 형식으로 정상적으로 쌓이는 걸 볼 수 있다.

(다만 이 과정에서 hubble enable이 작동하지 않고 꼬이는 바람에 인스턴스를 두 번이나 삭제하고 재설정을 반복했다^^)

 

timeout 5m hubble observe flows --from-namespace "sock-shop" --output=jsonpb > flows.json

 

해당 코드로 명령을 실행하면 5분동안 namespace가 "sock-shop"인 로그들만 json 형태로 기록된다.

728x90
반응형

'DevOps & Cloud' 카테고리의 다른 글

6. Go & Mongo DB  (0) 2023.01.13
5. sock-shop 과 XQuartz  (0) 2023.01.12
3. Cilium  (0) 2023.01.11
서버 및 쿠버네티스 설정값  (0) 2023.01.10
2. 쿠버네티스 설치 및 설정  (0) 2023.01.10