4장. 서비스를 모니터링하도록 Cluster Observability Operator 구성


COO(Cluster Observability Operator)에서 관리하는 모니터링 스택을 구성하여 서비스에 대한 메트릭을 모니터링할 수 있습니다.

서비스 모니터링을 테스트하려면 다음 단계를 따르십시오.

  • 서비스 엔드포인트를 정의하는 샘플 서비스를 배포합니다.
  • COO에서 서비스를 모니터링할 방법을 지정하는 ServiceMonitor 오브젝트를 생성합니다.
  • MonitoringStack 오브젝트를 생성하여 ServiceMonitor 오브젝트를 검색합니다.

4.1. Cluster Observability Operator의 샘플 서비스 배포

이 구성은 사용자 정의 ns1-coo 프로젝트에 prometheus-coo-example-app 이라는 샘플 서비스를 배포합니다. 서비스는 사용자 정의 버전 지표를 노출합니다.

사전 요구 사항

  • cluster-admin 클러스터 역할의 사용자로 또는 네임스페이스에 대한 관리 권한이 있는 사용자로 클러스터에 액세스할 수 있습니다.

프로세스

  1. 네임스페이스, 배포 및 서비스에 대한 다음 구성 세부 정보가 포함된 prometheus-coo-example-app.yaml 이라는 YAML 파일을 생성합니다.

    apiVersion: v1
    kind: Namespace
    metadata:
      name: ns1-coo
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      labels:
        app: prometheus-coo-example-app
      name: prometheus-coo-example-app
      namespace: ns1-coo
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: prometheus-coo-example-app
      template:
        metadata:
          labels:
            app: prometheus-coo-example-app
        spec:
          containers:
          - image: ghcr.io/rhobs/prometheus-example-app:0.4.2
            imagePullPolicy: IfNotPresent
            name: prometheus-coo-example-app
    ---
    apiVersion: v1
    kind: Service
    metadata:
      labels:
        app: prometheus-coo-example-app
      name: prometheus-coo-example-app
      namespace: ns1-coo
    spec:
      ports:
      - port: 8080
        protocol: TCP
        targetPort: 8080
        name: web
      selector:
        app: prometheus-coo-example-app
      type: ClusterIP
  2. 파일을 저장합니다.
  3. 다음 명령을 실행하여 클러스터에 구성을 적용합니다.

    $ oc apply -f prometheus-coo-example-app.yaml
  4. 다음 명령을 실행하고 출력을 관찰하여 포드가 실행 중인지 확인합니다.

    $ oc -n ns1-coo get pod

    출력 예

    NAME                                      READY     STATUS    RESTARTS   AGE
    prometheus-coo-example-app-0927545cb7-anskj   1/1       Running   0          81m

Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.