Skip to Content
Prometheus: Up & Running, 2nd Edition
book

Prometheus: Up & Running, 2nd Edition

by Julien Pivotto, Brian Brazil
May 2025
Beginner to intermediate
418 pages
6h 18m
Korean
O'Reilly Media, Inc.
Content preview from Prometheus: Up & Running, 2nd Edition

9장. 컨테이너와 Kubernetes

이 작품은 AI를 사용하여 번역되었습니다. 여러분의 피드백과 의견을 환영합니다: translation-feedback@oreilly.com

컨테이너 배포는 Docker 및 Kubernetes와 같은 기술을 통해 점점 더 보편화되고 있으며 이미 사용하고 있을 수도 있습니다. 이 장에서는 컨테이너와 함께 사용할 수 있는 내보내기를 다루고, Kubernetes에서 Prometheus를 사용하는 방법을 설명합니다.

7장에서 설명한 대로 노드 익스포터를 제외한 모든 Prometheus 구성 요소는 컨테이너에서 원활하게 실행됩니다.

cAdvisor

노드 익스포터가 머신에 대한 메트릭을 제공하는 것과 같은 방식으로,cAdvisor는 c그룹에 대한 메트릭을 제공하는 익스포터입니다. Cgroups는 일반적으로 Linux에서 컨테이너를 구현하는 데 사용되는 Linux 커널 격리 기능이며, systemd와 같은 런타임 환경에서도 사용됩니다.

Docker로 cAdvisor를 실행할 수 있습니다:

docker run \
  --volume=/:/rootfs:ro \
  --volume=/var/run:/var/run:rw \
  --volume=/sys:/sys:ro \
  --volume=/var/lib/docker/:/var/lib/docker:ro \
  --volume=/dev/disk/:/dev/disk:ro \
  --publish=8080:8080 \
  --detach=true \
  --name=cadvisor \
  gcr.io/cadvisor/cadvisor:v0.45.0

http://localhost:8080/metrics 을 방문하면 그림 9-1 에서 볼 수 있듯이 긴 메트릭 목록이 표시됩니다.

cAdvisor /metrics
그림 9-1. cAdvisor에서 /metrics 페이지의 시작

컨테이너 메트릭의 앞에는 container_ 이 붙으며, 모두 id 레이블이 있는 것을 볼 수 있습니다. /docker/ 또는 /system.slice/docker- 로 시작하는 id 레이블은 Docker 및 해당 컨테이너에서 가져온 것이며, /user.slice//system.slice/ 는 컴퓨터에서 실행 중인 systemd에서 가져온 것입니다. cgroups를 사용하는 다른 소프트웨어가 있는 경우 해당 cgroups도 나열됩니다.

이러한 메트릭은 다음과 같은 prometheus.yml을 사용하여 스크랩할 수 있습니다:

scrape_configs:
 - job_name: cadvisor
   static_configs:
    - targets:
      - localhost:8080

CPU

컨테이너 CPU에 대한 세 가지 메트릭을 찾을 수 있습니다:container_cpu_usage_seconds_​total, container_cpu_system_seconds_total, 그리고container_cpu_user_seconds_​ ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Prometheus: Up & Running, 2nd Edition

Prometheus: Up & Running, 2nd Edition

Julien Pivotto, Brian Brazil
Mastering Prometheus

Mastering Prometheus

William Hegedus
Argo CD: Up and Running

Argo CD: Up and Running

Andrew Block, Christian Hernandez
Kubernetes: Up and Running, 3rd Edition

Kubernetes: Up and Running, 3rd Edition

Brendan Burns, Joe Beda, Kelsey Hightower, Lachlan Evenson

Publisher Resources

ISBN: 9798341654181