Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 3. Using MicroShift Observability
MicroShift Observability collects and transmits system data for monitoring and analysis. The data includes performance and usage metrics, and error reporting.
3.1. Installing and enabling MicroShift Observability Link kopierenLink in die Zwischenablage kopiert!
You can install MicroShift Observability at any time, including during the initial MicroShift installation. Observability collects and transmits system data for monitoring and analysis, such as performance and usage metrics and error reporting.
Procedure
Install the
microshift-observabilityRPM by entering the following command:$ sudo dnf install microshift-observabilityEnable the
microshift-observabilitysystem service by entering the following command:$ sudo systemctl enable microshift-observabilityStart the
microshift-observabilitysystem service by entering the following command:$ sudo systemctl start microshift-observabilityRestart MicroShift after the initial installation.
$ sudo systemctl restart microshift-observabilityThe installation is successful if there is no output after you start the
microshift-observabilityRPM.
3.2. Configuring MicroShift Observability Link kopierenLink in die Zwischenablage kopiert!
You must configure MicroShift Observability after it is installed by specifying a valid endpoint. You can specify any OpenTelemetry Protocol (OTLP)-compatible endpoint for each configuration before starting MicroShift.
If an endpoint is not specified, MicroShift Observability does not start.
Procedure
Update the
/etc/microshift/observability/opentelemetry-collector.yamlfile to specify an OTLP-compatible endpoint with the following information. The endpoint must link to an IP address or host name, and port number of an OTLP service.OTLP-compatible endpoint configuration
# ... exporters: otlp: sending_queue: storage: file_storage endpoint: ${env:OTEL_BACKEND}:4317 tls: insecure: true # ... service: # ... telemetry: metrics: readers: - periodic: exporter: otlp: protocol: http/protobuf endpoint: http://${env:OTEL_BACKEND}:4318 # ...Replace
${env:OTEL_BACKEND}with the IP address or hostname of the remote back end. This IP address resolves to the local node’s hostname. An unreachable endpoint is reported in the MicroShift service logs.Each time that you update the
opentelemetry-collector.yamlfile, you must restart MicroShift Observability to apply the updates.Restart MicroShift Observability by entering the following command:
$ sudo systemctl restart microshift-observability
3.3. Selecting a MicroShift Observability configuration Link kopierenLink in die Zwischenablage kopiert!
The opentelemetry-collector.yaml file includes specific parameters that are used to collect data for monitoring the system resources. All warnings for node events are included in the collected data.
MicroShift Observability collects and transmits data for the following resources:
- CPU, memory, disk, and network metrics of containers, pods, and nodes
- Kubernetes events
- Host CPU, memory, disk, and network metrics
- System journals for certain MicroShift services, and dependencies
-
Metrics exposed by pods that have the
prometheus.io/scrape:trueannotation
The amount and complexity of the data depends on predefined configurations. These configurations determine the number of data sources and the amount of collected data that is transmitted. These configurations are defined as small, medium, and large. Large is the default configuration.
Replace the values of the exporters.otlp.endpoint and services.telemetry.metrics.readers[0].endpoint fields with the IP address or hostname of the remote back end. This IP address resolves to the local node’s host name. Any unreachable endpoint is reported in the MicroShift observability service logs.
3.4. Selecting a small configuration Link kopierenLink in die Zwischenablage kopiert!
You can configure MicroShift Observability to collect the smallest amount of performance and resource information from various sources by updating the YAML file.
Procedure
Select a small configuration by adding the following information to the
/etc/microshift/observability/opentelemetry-collector.yamlfile:receivers: kubeletstats: auth_type: tls ca_file: /var/lib/microshift/certs/ca-bundle/client-ca.crt key_file: /var/lib/microshift/certs/admin-kubeconfig-signer/openshift-observability-client/client.key cert_file: /var/lib/microshift/certs/admin-kubeconfig-signer/openshift-observability-client/client.crt insecure_skip_verify: true collection_interval: 10s endpoint: "${env:K8S_NODE_NAME}:10250" node: ${env:K8S_NODE_NAME} k8s_api_config: auth_type: kubeConfig k8s_events: auth_type: kubeConfig processors: batch: resourcedetection/system: detectors: [ "system" ] system: hostname_sources: [ "os" ] exporters: otlp: sending_queue: storage: file_storage endpoint: ${env:OTEL_BACKEND}:4317 tls: insecure: true extensions: file_storage: directory: /var/lib/microshift-observability service: extensions: [ file_storage ] pipelines: metrics/kubeletstats: receivers: [ kubeletstats ] processors: [ batch ] exporters: [ otlp ] logs/kube_events: receivers: [ k8s_events ] processors: [ resourcedetection/system, batch ] exporters: [ otlp ] telemetry: metrics: readers: - periodic: exporter: otlp: protocol: http/protobuf endpoint: http://${env:OTEL_BACKEND}:4318Replace the variable
${env:OTEL_BACKEND}with the IP address or hostname of the remote back end. This IP address resolves to the local node’s hostname. Any unreachable endpoint is reported in the MicroShift service logs.Restart MicroShift Observability to complete the configuration selection by entering the following command:
$ sudo systemctl restart microshift-observability
3.5. Selecting a medium configuration Link kopierenLink in die Zwischenablage kopiert!
You can configure MicroShift Observability to collect performance and resource information from various sources by updating the YAML file.
Procedure
Select a medium configuration by adding the following information to the
/etc/microshift/observability/opentelemetry-collector.yamlfile:receivers: kubeletstats: auth_type: tls ca_file: /var/lib/microshift/certs/ca-bundle/client-ca.crt key_file: /var/lib/microshift/certs/admin-kubeconfig-signer/openshift-observability-client/client.key cert_file: /var/lib/microshift/certs/admin-kubeconfig-signer/openshift-observability-client/client.crt insecure_skip_verify: true collection_interval: 10s endpoint: "${env:K8S_NODE_NAME}:10250" node: ${env:K8S_NODE_NAME} k8s_api_config: auth_type: kubeConfig k8s_events: auth_type: kubeConfig journald: units: - microshift priority: info processors: batch: resourcedetection/system: detectors: [ "system" ] system: hostname_sources: [ "os" ] exporters: otlp: sending_queue: storage: file_storage endpoint: ${env:OTEL_BACKEND}:4317 tls: insecure: true extensions: file_storage: directory: /var/lib/microshift-observability service: extensions: [ file_storage ] pipelines: metrics/kubeletstats: receivers: [ kubeletstats ] processors: [ batch ] exporters: [ otlp ] logs/kube_events: receivers: [ k8s_events ] processors: [ resourcedetection/system, batch ] exporters: [ otlp ] logs/journald: receivers: [ journald ] processors: [ resourcedetection/system ] exporters: [ otlp ] telemetry: metrics: readers: - periodic: exporter: otlp: protocol: http/protobuf endpoint: http://${env:OTEL_BACKEND}:4318Replace the variable
${env:OTEL_BACKEND}with the IP address or hostname of the remote back end. This IP address resolves to the local node’s hostname. Any unreachable endpoint is reported in themicroshift-observabilityservice logs.Restart MicroShift Observability to complete the configuration selection by entering the following command:
$ sudo systemctl restart microshift-observability
3.6. Selecting a large configuration Link kopierenLink in die Zwischenablage kopiert!
You can configure MicroShift Observability to collect the maximum amount of performance and resource information, from the maximum number of sources, by updating the YAML file.
Procedure
Select a large configuration by adding the following information to the
/etc/microshift/observability/opentelemetry-collector.yamlfile.Largeis the default configuration.receivers: kubeletstats: auth_type: tls ca_file: /var/lib/microshift/certs/ca-bundle/client-ca.crt key_file: /var/lib/microshift/certs/admin-kubeconfig-signer/openshift-observability-client/client.key cert_file: /var/lib/microshift/certs/admin-kubeconfig-signer/openshift-observability-client/client.crt insecure_skip_verify: true collection_interval: 10s endpoint: "${env:K8S_NODE_NAME}:10250" node: ${env:K8S_NODE_NAME} k8s_api_config: auth_type: kubeConfig k8s_events: auth_type: kubeConfig hostmetrics: root_path: / collection_interval: 10s scrapers: cpu: memory: network: disk: filesystem: journald: units: - microshift - microshift-observability - microshift-etcd - crio - openvswitch.service - ovsdb-server.service - ovs-vswitchd.service priority: info prometheus: config: scrape_configs: - job_name: k8s scrape_interval: 10s kubernetes_sd_configs: - kubeconfig_file: /var/lib/microshift/resources/observability-client/kubeconfig role: pod relabel_configs: # Only scrape Pods with annotation "prometheus.io/scrape": "true" - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape] action: keep regex: true # Use value of "prometheus.io/path" annotation for scraping - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path] action: replace target_label: __metrics_path__ regex: (.+) # Use value of "prometheus.io/port" annotation for scraping - source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port] action: replace regex: ([^:]+)(?::\d+)?;(\d+) replacement: $1:$2 target_label: __address__ processors: batch: resourcedetection/system: detectors: [ "system" ] system: hostname_sources: [ "os" ] exporters: otlp: sending_queue: storage: file_storage endpoint: ${env:OTEL_BACKEND}:4317 tls: insecure: true extensions: file_storage: directory: /var/lib/microshift-observability service: extensions: [ file_storage ] pipelines: metrics/kubeletstats: receivers: [ kubeletstats ] processors: [ batch ] exporters: [ otlp ] metrics/hostmetrics: receivers: [ hostmetrics ] processors: [ resourcedetection/system, batch ] exporters: [ otlp ] logs/kube_events: receivers: [ k8s_events ] processors: [ resourcedetection/system, batch ] exporters: [ otlp ] logs/host: receivers: [ hostmetrics ] processors: [ resourcedetection/system ] exporters: [ otlp ] logs/journald: receivers: [ journald ] processors: [ resourcedetection/system ] exporters: [ otlp ] metrics/pods: receivers: [ prometheus ] processors: [ batch ] exporters: [ otlp ] telemetry: metrics: readers: - periodic: exporter: otlp: protocol: http/protobuf endpoint: http://${env:OTEL_BACKEND}:4318Replace the variable
${env:OTEL_BACKEND}with the IP address or hostname of the remote back end. This IP address resolves to the local node’s hostname. Any unreachable endpoint is reported in themicroshift-observabilityservice logs.Restart MicroShift Observability to complete the configuration selection by entering the following command:
$ sudo systemctl restart microshift-observability
3.7. Verifying the MicroShift Observability state Link kopierenLink in die Zwischenablage kopiert!
After MicroShift Observability starts, you can verify the state by using a systemd service. The MicroShift Observability service logs are available as journald logs.
Procedure
Check the MicroShift Observability status by entering the following command:
$ sudo systemctl status microshift-observabilityCheck the MicroShift Observability logs by entering the following command:
$ sudo journalctl -u microshift-observability