반응형
cAdvisor container로 배포 해서 확인 하는 방법(storage driver = Kafka)
cAdvisor에서 Kafka로 지표 전달 가능함.
storage_driver 설정을 kafka로 설정하면 됨
[참고 링크]
Kafka 클러스터 실행
kafka download
wget https://archive.apache.org/dist/kafka/3.1.0/kafka_2.13-3.1.0.tgz
tar xvf kafka_2.13-3.1.0.tgz
cd kafka_2.13-3.1.0
kafka 설정 파일 변경
vim config/server.properties
아래 2개 내용 추가
listeners=PLAINTEXT://0.0.0.0:9092
advertised.listeners=PLAINTEXT://133.186.163.60:9092
kafka 실행
bin/zookeeper-server-start.sh config/zookeeper.properties
bin/kafka-server-start.sh config/server.properties
[kafka 명령어 정리]
토픽 생성
./kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 3 --topic test
토픽 삭제
./kafka-topics.sh --delete --topic kube_test --bootstrap-server localhost:9092
토픽 조회
./kafka-topics.sh --describe --bootstrap-server localhost:9092
토픽 이벤트 조회
./kafka-console-consumer.sh --bootstrap-server localhost:9092 --from-beginning --topic kube_test
참고 링크
cAdvisor container 실행
nerdctl run \
--volume=/:/rootfs:ro \
--volume=/var/run:/var/run:rw \
--volume=/sys:/sys:ro \
--network host \
--detach=true \
--name=cadvisor \
--privileged \
gcr.io/cadvisor/cadvisor:v0.47.0 \
--storage_driver=kafka \
--storage_driver_kafka_broker_list=192.168.0.72:9092 \
--storage_driver_kafka_topic=kube_test
storage_driver_kafka_broker_list 설정에
kafka가 실행 중인 host ip 입력.
토픽은 "kube_test"로 설정
결과 확인
아래와 같이 cAdvisor 컨테이너가 정상 실행됨
컨테이너가 실행되면서 kafka에 kube_test 토픽은 자동으로 생성됨.
토픽 이벤트에서 cadvisor 수집 내용 정상 확인 가능.
아래와 같이 host에서 실행 중인 container의 지표 정보도 수집가능함.
{"timestamp":"2023-04-03T00:00:12.674870998Z","machine_name":"2e79b19d7a6d","container_Name":"/system.slice/kube-apiserver.service","container_stats":{"timestamp":"2023-04-03T00:00:12.674832861Z","cpu":{"usage":{"total":1517422879969,"per_cpu_usage":[758520079913,758902800056],"user":752100000000,"system":725360000000},"cfs":{"periods":0,"throttled_periods":0,"throttled_time":0},"schedstat":{"run_time":0,"runqueue_time":0,"run_periods":0},"load_average":0},"diskio":{"io_service_bytes":[{"device":"/dev/vda","major":252,"minor":0,"stats":{"Async":0,"Read":24576,"Sync":24576,"Total":24576,"Write":0}}],"io_serviced":[{"device":"/dev/vda","major":252,"minor":0,"stats":{"Async":0,"Read":2,"Sync":2,"Total":2,"Write":0}}]},"memory":{"usage":9777152,"max_usage":10592256,"cache":0,"rss":8450048,"swap":0,"mapped_file":0,"working_set":9773056,"failcnt":0,"container_data":{"pgfault":6864,"pgmajfault":0,"numa_stats":{}},"hierarchical_data":{"pgfault":6864,"pgmajfault":0,"numa_stats":{}}},"network":{"name":"","rx_bytes":0,"rx_packets":0,"rx_errors":0,"rx_dropped":0,"tx_bytes":0,"tx_packets":0,"tx_errors":0,"tx_dropped":0,"tcp":{"Established":0,"SynSent":0,"SynRecv":0,"FinWait1":0,"FinWait2":0,"TimeWait":0,"Close":0,"CloseWait":0,"LastAck":0,"Listen":0,"Closing":0},"tcp6":{"Established":0,"SynSent":0,"SynRecv":0,"FinWait1":0,"FinWait2":0,"TimeWait":0,"Close":0,"CloseWait":0,"LastAck":0,"Listen":0,"Closing":0},"udp":{"Listen":0,"Dropped":0,"RxQueued":0,"TxQueued":0},"udp6":{"Listen":0,"Dropped":0,"RxQueued":0,"TxQueued":0},"tcp_advanced":{"RtoAlgorithm":0,"RtoMin":0,"RtoMax":0,"MaxConn":0,"ActiveOpens":0,"PassiveOpens":0,"AttemptFails":0,"EstabResets":0,"CurrEstab":0,"InSegs":0,"OutSegs":0,"RetransSegs":0,"InErrs":0,"OutRsts":0,"InCsumErrors":0,"EmbryonicRsts":0,"SyncookiesSent":0,"SyncookiesRecv":0,"SyncookiesFailed":0,"PruneCalled":0,"RcvPruned":0,"OfoPruned":0,"OutOfWindowIcmps":0,"LockDroppedIcmps":0,"TW":0,"TWRecycled":0,"TWKilled":0,"TCPTimeWaitOverflow":0,"TCPTimeouts":0,"TCPSpuriousRTOs":0,"TCPLossProbes":0,"TCPLossProbeRecovery":0,"TCPRenoRecoveryFail":0,"TCPSackRecoveryFail":0,"TCPRenoFailures":0,"TCPSackFailures":0,"TCPLossFailures":0,"DelayedACKs":0,"DelayedACKLocked":0,"DelayedACKLost":0,"ListenOverflows":0,"ListenDrops":0,"TCPHPHits":0,"TCPPureAcks":0,"TCPHPAcks":0,"TCPRenoRecovery":0,"TCPSackRecovery":0,"TCPSACKReneging":0,"TCPFACKReorder":0,"TCPSACKReorder":0,"TCPRenoReorder":0,"TCPTSReorder":0,"TCPFullUndo":0,"TCPPartialUndo":0,"TCPDSACKUndo":0,"TCPLossUndo":0,"TCPFastRetrans":0,"TCPSlowStartRetrans":0,"TCPLostRetransmit":0,"TCPRetransFail":0,"TCPRcvCollapsed":0,"TCPDSACKOldSent":0,"TCPDSACKOfoSent":0,"TCPDSACKRecv":0,"TCPDSACKOfoRecv":0,"TCPAbortOnData":0,"TCPAbortOnClose":0,"TCPAbortOnMemory":0,"TCPAbortOnTimeout":0,"TCPAbortOnLinger":0,"TCPAbortFailed":0,"TCPMemoryPressures":0,"TCPMemoryPressuresChrono":0,"TCPSACKDiscard":0,"TCPDSACKIgnoredOld":0,"TCPDSACKIgnoredNoUndo":0,"TCPMD5NotFound":0,"TCPMD5Unexpected":0,"TCPMD5Failure":0,"TCPSackShifted":0,"TCPSackMerged":0,"TCPSackShiftFallback":0,"TCPBacklogDrop":0,"PFMemallocDrop":0,"TCPMinTTLDrop":0,"TCPDeferAcceptDrop":0,"IPReversePathFilter":0,"TCPReqQFullDoCookies":0,"TCPReqQFullDrop":0,"TCPFastOpenActive":0,"TCPFastOpenActiveFail":0,"TCPFastOpenPassive":0,"TCPFastOpenPassiveFail":0,"TCPFastOpenListenOverflow":0,"TCPFastOpenCookieReqd":0,"TCPSynRetrans":0,"TCPOrigDataSent":0,"PAWSActive":0,"PAWSEstab":0}},"task_stats":{"nr_sleeping":0,"nr_running":0,"nr_stopped":0,"nr_uninterruptible":0,"nr_io_wait":0},"processes":{"process_count":0,"fd_count":0,"socket_count":0},"resctrl":{},"cpuset":{"memory_migrate":0}}}
반응형
'Kubernetes > Monitoring' 카테고리의 다른 글
Kubernetes 모니터링 : metricbeat 란? (0) | 2024.09.07 |
---|---|
Kubernetes 모니터링 : kube-state-metrics 란? (0) | 2024.09.05 |
kubernetes 모니터링 : cAdvisor 란? (cAdvisor분석 version2) (0) | 2024.09.05 |
Kubernetes 모니터링 : node-exporter 란? (0) | 2024.09.05 |
kubernetes kubelet cAdvisor 분석 (0) | 2021.07.17 |