검색

3.2. OpenTelemetry 수집기를 사용하여 여러 클러스터에서 관찰 기능 데이터 수집

download PDF

다중 클러스터 구성의 경우 원격 클러스터 각각에 하나의 OpenTelemetry 수집기 인스턴스를 생성한 다음 모든 Telemetry 데이터를 하나의 OpenTelemetry 수집기 인스턴스로 전달할 수 있습니다.

사전 요구 사항

  • Red Hat build of OpenTelemetry Operator가 설치되어 있습니다.
  • Tempo Operator가 설치되어 있습니다.
  • TempoStack 인스턴스는 클러스터에 배포됩니다.
  • 다음 마운트된 인증서: 발급자, 자체 서명 인증서, CA 발급자, 클라이언트 및 서버 인증서입니다. 이러한 인증서를 생성하려면 1단계를 참조하십시오.

프로세스

  1. OpenTelemetry 수집기 인스턴스에 다음 인증서를 마운트하고 이미 마운트된 인증서를 건너뜁니다.

    1. cert-manager Operator for Red Hat OpenShift를 사용하여 인증서를 생성하는 발행자입니다.

      apiVersion: cert-manager.io/v1
      kind: Issuer
      metadata:
        name: selfsigned-issuer
      spec:
        selfSigned: {}
    2. 자체 서명된 인증서입니다.

      apiVersion: cert-manager.io/v1
      kind: Certificate
      metadata:
        name: ca
      spec:
        isCA: true
        commonName: ca
        subject:
          organizations:
            - Organization # <your_organization_name>
          organizationalUnits:
            - Widgets
        secretName: ca-secret
        privateKey:
          algorithm: ECDSA
          size: 256
        issuerRef:
          name: selfsigned-issuer
          kind: Issuer
          group: cert-manager.io
    3. CA 발행자.

      apiVersion: cert-manager.io/v1
      kind: Issuer
      metadata:
        name: test-ca-issuer
      spec:
        ca:
          secretName: ca-secret
    4. 클라이언트 및 서버 인증서입니다.

      apiVersion: cert-manager.io/v1
      kind: Certificate
      metadata:
        name: server
      spec:
        secretName: server-tls
        isCA: false
        usages:
          - server auth
          - client auth
        dnsNames:
        - "otel.observability.svc.cluster.local" 1
        issuerRef:
          name: ca-issuer
      ---
      apiVersion: cert-manager.io/v1
      kind: Certificate
      metadata:
        name: client
      spec:
        secretName: client-tls
        isCA: false
        usages:
          - server auth
          - client auth
        dnsNames:
        - "otel.observability.svc.cluster.local" 2
        issuerRef:
          name: ca-issuer
      1
      OpenTelemetry 수집기 인스턴스의 솔버에 매핑될 정확한 DNS 이름 목록입니다.
      2
      클라이언트 OpenTelemetry 수집기 인스턴스에서 솔버에 매핑될 정확한 DNS 이름 목록입니다.
  2. OpenTelemetry 수집기 인스턴스에 대한 서비스 계정을 생성합니다.

    서비스 계정의 예

    apiVersion: v1
    kind: ServiceAccount
    metadata:
      name: otel-collector-deployment

  3. 서비스 계정에 대한 클러스터 역할을 생성합니다.

    클러스터 역할의 예

    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRole
    metadata:
      name: otel-collector
    rules:
      1
      2
    - apiGroups: ["", "config.openshift.io"]
      resources: ["pods", "namespaces", "infrastructures", "infrastructures/status"]
      verbs: ["get", "watch", "list"]

    1
    k8sattributesprocessor 에는 Pod 및 네임스페이스 리소스에 대한 권한이 필요합니다.
    2
    resourcedetectionprocessor에는 인프라 및 상태에 대한 권한이 필요합니다.
  4. 클러스터 역할을 서비스 계정에 바인딩합니다.

    클러스터 역할 바인딩 예

    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRoleBinding
    metadata:
      name: otel-collector
    subjects:
    - kind: ServiceAccount
      name: otel-collector-deployment
      namespace: otel-collector-<example>
    roleRef:
      kind: ClusterRole
      name: otel-collector
      apiGroup: rbac.authorization.k8s.io

  5. YAML 파일을 생성하여 엣지 클러스터에서 OpenTelemetryCollector CR(사용자 정의 리소스)을 정의합니다.

    엣지 클러스터에 대한 OpenTelemetryCollector 사용자 정의 리소스의 예

    apiVersion: opentelemetry.io/v1alpha1
    kind: OpenTelemetryCollector
    metadata:
      name: otel
      namespace: otel-collector-<example>
    spec:
      mode: daemonset
      serviceAccount: otel-collector-deployment
      config: |
        receivers:
          jaeger:
            protocols:
              grpc:
              thrift_binary:
              thrift_compact:
              thrift_http:
          opencensus:
          otlp:
            protocols:
              grpc:
              http:
          zipkin:
        processors:
          batch:
          k8sattributes:
          memory_limiter:
            check_interval: 1s
            limit_percentage: 50
            spike_limit_percentage: 30
          resourcedetection:
            detectors: [openshift]
        exporters:
          otlphttp:
            endpoint: https://observability-cluster.com:443 1
            tls:
              insecure: false
              cert_file: /certs/server.crt
              key_file: /certs/server.key
              ca_file: /certs/ca.crt
        service:
          pipelines:
            traces:
              receivers: [jaeger, opencensus, otlp, zipkin]
              processors: [memory_limiter, k8sattributes, resourcedetection, batch]
              exporters: [otlp]
      volumes:
        - name: otel-certs
          secret:
            name: otel-certs
      volumeMounts:
        - name: otel-certs
          mountPath: /certs

    1
    수집기 내보내기는 OTLP HTTP를 내보내도록 구성되며 중앙 클러스터에서 OpenTelemetry 수집기를 가리킵니다.
  6. YAML 파일을 생성하여 중앙 클러스터에서 OpenTelemetryCollector CR(사용자 정의 리소스)을 정의합니다.

    중앙 클러스터에 대한 OpenTelemetryCollector 사용자 정의 리소스의 예

    apiVersion: opentelemetry.io/v1alpha1
    kind: OpenTelemetryCollector
    metadata:
      name: otlp-receiver
      namespace: observability
    spec:
      mode: "deployment"
      ingress:
        type: route
        route:
          termination: "passthrough"
      config: |
        receivers:
          otlp:
            protocols:
              http:
                tls: 1
                  cert_file: /certs/server.crt
                  key_file: /certs/server.key
                  client_ca_file: /certs/ca.crt
        exporters:
          logging:
          otlp:
            endpoint: "tempo-<simplest>-distributor:4317" 2
            tls:
              insecure: true
        service:
          pipelines:
            traces:
              receivers: [otlp]
              processors: []
              exporters: [otlp]
      volumes:
        - name: otel-certs
          secret:
            name: otel-certs
      volumeMounts:
        - name: otel-certs
          mountPath: /certs

    1
    수집기 수신자는 첫 번째 단계에 나열된 인증서가 필요합니다.
    2
    수집기 내보내기는 OTLP를 내보내도록 구성되어 있으며 Tempo 배포자 끝점을 가리킵니다. 이 예제에서는 "tempo-simplest-distributor:4317" 이며 이미 생성되었습니다.
Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

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

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

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

Red Hat 소개

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

© 2024 Red Hat, Inc.