3.3. 대상 al Cryostat
대상 al Cryostat는 OpenTelemetry 수집기 인스턴스의 배포된 플릿에서 대상을 스크랩하는 OpenTelemetry Operator의 선택적 구성 요소입니다. 대상 al Cryostat는 Prometheus PodMonitor
및 ServiceMonitor
CR(사용자 정의 리소스)과 통합됩니다. 대상이 활성화된 경우 OpenTelemetry Operator는 대상 al Cryostat 서비스에 연결하는 활성화된 prometheus
수신자에 http_sd_config
필드를 추가합니다.
활성화된 대상 al Cryostat를 사용하는 OpenTelemetryCollector CR의 예
apiVersion: opentelemetry.io/v1alpha1 kind: OpenTelemetryCollector metadata: name: otel namespace: observability spec: mode: statefulset targetAllocator: enabled: true serviceAccount: prometheusCR: enabled: true scrapeInterval: 10s serviceMonitorSelector: name: app1 podMonitorSelector: name: app2 config: | receivers: prometheus: config: scrape_configs: [] processors: exporters: debug: service: pipelines: metrics: receivers: [prometheus] processors: [] exporters: [debug]
apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
name: otel
namespace: observability
spec:
mode: statefulset
targetAllocator:
enabled: true
serviceAccount:
prometheusCR:
enabled: true
scrapeInterval: 10s
serviceMonitorSelector:
name: app1
podMonitorSelector:
name: app2
config: |
receivers:
prometheus:
config:
scrape_configs: []
processors:
exporters:
debug:
service:
pipelines:
metrics:
receivers: [prometheus]
processors: []
exporters: [debug]
- 1
- 대상 al Cryostat가 활성화된 경우 배포 모드를
상태 저장 세트로 설정해야
합니다. - 2
- 대상 al Cryostat를 활성화합니다. 기본값은
false
입니다. - 3
- 대상 al Cryostat 배포의 서비스 계정 이름입니다. 서비스 계정에는
ServiceMonitor
,PodMonitor
사용자 정의 리소스 및 클러스터의 기타 오브젝트를 가져오려면 RBAC가 있어야 스크랩된 메트릭에 라벨을 올바르게 설정해야 합니다. 기본 서비스 이름은 <collector_name>-targetal Cryostat입니다
. - 4
- Prometheus
PodMonitor
및ServiceMonitor
사용자 정의 리소스와의 통합을 활성화합니다. - 5
- Prometheus
ServiceMonitor
사용자 정의 리소스의 라벨 선택기입니다. 비어 있는 경우 모든 서비스 모니터를 활성화합니다. - 6
- Prometheus
PodMonitor
사용자 정의 리소스의 라벨 선택기입니다. 비어 있는 경우 모든 Pod 모니터를 활성화합니다. - 7
- 최소 빈
scrape_config: []
구성 옵션이 있는 Prometheus 수신자.
대상 al Cryostat 배포에서는 Kubernetes API를 사용하여 클러스터에서 관련 오브젝트를 가져오므로 사용자 지정 RBAC 구성이 필요합니다.
대상 al Cryostat 서비스 계정에 대한 RBAC 구성
apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: otel-targetallocator rules: - apiGroups: [""] resources: - services - pods verbs: ["get", "list", "watch"] - apiGroups: ["monitoring.coreos.com"] resources: - servicemonitors - podmonitors verbs: ["get", "list", "watch"] - apiGroups: ["discovery.k8s.io"] resources: - endpointslices verbs: ["get", "list", "watch"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: otel-targetallocator roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: otel-targetallocator subjects: - kind: ServiceAccount name: otel-targetallocator namespace: observability
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: otel-targetallocator
rules:
- apiGroups: [""]
resources:
- services
- pods
verbs: ["get", "list", "watch"]
- apiGroups: ["monitoring.coreos.com"]
resources:
- servicemonitors
- podmonitors
verbs: ["get", "list", "watch"]
- apiGroups: ["discovery.k8s.io"]
resources:
- endpointslices
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: otel-targetallocator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: otel-targetallocator
subjects:
- kind: ServiceAccount
name: otel-targetallocator
namespace: observability