Questo contenuto non è disponibile nella lingua selezionata.
Chapter 16. Cluster Observability Operator
16.1. Cluster Observability Operator release notes Copia collegamentoCollegamento copiato negli appunti!
The Cluster Observability Operator is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
The Cluster Observability Operator (COO) is an optional OpenShift Container Platform Operator that enables administrators to create standalone monitoring stacks that are independently configurable for use by different services and users.
The COO complements the built-in monitoring capabilities of OpenShift Container Platform. You can deploy it in parallel with the default platform and user workload monitoring stacks managed by the Cluster Monitoring Operator (CMO).
These release notes track the development of the Cluster Observability Operator in OpenShift Container Platform.
16.1.1. Cluster Observability Operator 0.1.1 Copia collegamentoCollegamento copiato negli appunti!
This release updates the Cluster Observability Operator to support installing the Operator in restricted networks or disconnected environments.
16.1.2. Cluster Observability Operator 0.1 Copia collegamentoCollegamento copiato negli appunti!
This release makes a Technology Preview version of the Cluster Observability Operator available on OperatorHub.
16.2. Cluster Observability Operator overview Copia collegamentoCollegamento copiato negli appunti!
The Cluster Observability Operator is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
The Cluster Observability Operator (COO) is an optional component of the OpenShift Container Platform. You can deploy it to create standalone monitoring stacks that are independently configurable for use by different services and users.
The COO deploys the following monitoring components:
- Prometheus
- Thanos Querier (optional)
- Alertmanager (optional)
The COO components function independently of the default in-cluster monitoring stack, which is deployed and managed by the Cluster Monitoring Operator (CMO). Monitoring stacks deployed by the two Operators do not conflict. You can use a COO monitoring stack in addition to the default platform monitoring components deployed by the CMO.
16.2.1. Understanding the Cluster Observability Operator Copia collegamentoCollegamento copiato negli appunti!
A default monitoring stack created by the Cluster Observability Operator (COO) includes a highly available Prometheus instance capable of sending metrics to an external endpoint by using remote write.
Each COO stack also includes an optional Thanos Querier component, which you can use to query a highly available Prometheus instance from a central location, and an optional Alertmanager component, which you can use to set up alert configurations for different services.
16.2.1.1. Advantages of using the Cluster Observability Operator Copia collegamentoCollegamento copiato negli appunti!
The
MonitoringStack
Deploying a COO-managed monitoring stack can help meet monitoring needs that are difficult or impossible to address by using the core platform monitoring stack deployed by the Cluster Monitoring Operator (CMO). A monitoring stack deployed using COO has the following advantages over core platform and user workload monitoring:
- Extendability
- Users can add more metrics to a COO-deployed monitoring stack, which is not possible with core platform monitoring without losing support. In addition, COO-managed stacks can receive certain cluster-specific metrics from core platform monitoring by using federation.
- Multi-tenancy support
- The COO can create a monitoring stack per user namespace. You can also deploy multiple stacks per namespace or a single stack for multiple namespaces. For example, cluster administrators, SRE teams, and development teams can all deploy their own monitoring stacks on a single cluster, rather than having to use a single shared stack of monitoring components. Users on different teams can then independently configure features such as separate alerts, alert routing, and alert receivers for their applications and services.
- Scalability
- You can create COO-managed monitoring stacks as needed. Multiple monitoring stacks can run on a single cluster, which can facilitate the monitoring of very large clusters by using manual sharding. This ability addresses cases where the number of metrics exceeds the monitoring capabilities of a single Prometheus instance.
- Flexibility
- Deploying the COO with Operator Lifecycle Manager (OLM) decouples COO releases from OpenShift Container Platform release cycles. This method of deployment enables faster release iterations and the ability to respond rapidly to changing requirements and issues. Additionally, by deploying a COO-managed monitoring stack, users can manage alerting rules independently of OpenShift Container Platform release cycles.
- Highly customizable
- The COO can delegate ownership of single configurable fields in custom resources to users by using Server-Side Apply (SSA), which enhances customization.
16.3. Installing the Cluster Observability Operator Copia collegamentoCollegamento copiato negli appunti!
The Cluster Observability Operator is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
As a cluster administrator, you can install the Cluster Observability Operator (COO) from OperatorHub by using the OpenShift Container Platform web console or CLI. OperatorHub is a user interface that works in conjunction with Operator Lifecycle Manager (OLM), which installs and manages Operators on a cluster.
To install the COO using OperatorHub, follow the procedure described in Adding Operators to a cluster.
16.3.1. Uninstalling the Cluster Observability Operator using the web console Copia collegamentoCollegamento copiato negli appunti!
If you have installed the Cluster Observability Operator (COO) by using OperatorHub, you can uninstall it in the OpenShift Container Platform web console.
Prerequisites
-
You have access to the cluster as a user with the cluster role.
cluster-admin - You have logged in to the OpenShift Container Platform web console.
Procedure
-
Go to Operators
Installed Operators. - Locate the Cluster Observability Operator entry in the list.
-
Click
for this entry and select Uninstall Operator.
16.4. Configuring the Cluster Observability Operator to monitor a service Copia collegamentoCollegamento copiato negli appunti!
The Cluster Observability Operator is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
You can monitor metrics for a service by configuring monitoring stacks managed by the Cluster Observability Operator (COO).
To test monitoring a service, follow these steps:
- Deploy a sample service that defines a service endpoint.
-
Create a object that specifies how the service is to be monitored by the COO.
ServiceMonitor -
Create a object to discover the
MonitoringStackobject.ServiceMonitor
16.4.1. Deploying a sample service for Cluster Observability Operator Copia collegamentoCollegamento copiato negli appunti!
This configuration deploys a sample service named
prometheus-coo-example-app
ns1-coo
version
Prerequisites
-
You have access to the cluster as a user with the cluster role or as a user with administrative permissions for the namespace.
cluster-admin
Procedure
Create a YAML file named
that contains the following configuration details for a namespace, deployment, and service:prometheus-coo-example-app.yamlapiVersion: 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- Save the file.
Apply the configuration to the cluster by running the following command:
$ oc apply -f prometheus-coo-example-app.yamlVerify that the pod is running by running the following command and observing the output:
$ oc -n -ns1-coo get podExample output
NAME READY STATUS RESTARTS AGE prometheus-coo-example-app-0927545cb7-anskj 1/1 Running 0 81m
16.4.2. Specifying how a service is monitored by Cluster Observability Operator Copia collegamentoCollegamento copiato negli appunti!
To use the metrics exposed by the sample service you created in the "Deploying a sample service for Cluster Observability Operator" section, you must configure monitoring components to scrape metrics from the
/metrics
You can create this configuration by using a
ServiceMonitor
PodMonitor
ServiceMonitor
Service
PodMonitor
MonitoringStack
This procedure shows how to create a
ServiceMonitor
prometheus-coo-example-app
ns1-coo
Prerequisites
-
You have access to the cluster as a user with the cluster role or as a user with administrative permissions for the namespace.
cluster-admin - You have installed the Cluster Observability Operator.
You have deployed the
sample service in theprometheus-coo-example-appnamespace.ns1-cooNoteThe
sample service does not support TLS authentication.prometheus-coo-example-app
Procedure
Create a YAML file named
that contains the followingexample-coo-app-service-monitor.yamlobject configuration details:ServiceMonitorapiVersion: monitoring.rhobs/v1alpha1 kind: ServiceMonitor metadata: labels: k8s-app: prometheus-coo-example-monitor name: prometheus-coo-example-monitor namespace: ns1-coo spec: endpoints: - interval: 30s port: web scheme: http selector: matchLabels: app: prometheus-coo-example-appThis configuration defines a
object that theServiceMonitorobject will reference to scrape the metrics data exposed by theMonitoringStacksample service.prometheus-coo-example-appApply the configuration to the cluster by running the following command:
$ oc apply -f example-app-service-monitor.yamlVerify that the
resource is created by running the following command and observing the output:ServiceMonitor$ oc -n ns1-coo get servicemonitorExample output
NAME AGE prometheus-coo-example-monitor 81m
16.4.3. Creating a MonitoringStack object for the Cluster Observability Operator Copia collegamentoCollegamento copiato negli appunti!
To scrape the metrics data exposed by the target
prometheus-coo-example-app
MonitoringStack
ServiceMonitor
MonitoringStack
Prerequisites
-
You have access to the cluster as a user with the cluster role or as a user with administrative permissions for the namespace.
cluster-admin - You have installed the Cluster Observability Operator.
-
You have deployed the sample service in the
prometheus-coo-example-appnamespace.ns1-coo -
You have created a object named
ServiceMonitorin theprometheus-coo-example-monitornamespace.ns1-coo
Procedure
-
Create a YAML file for the object configuration. For this example, name the file
MonitoringStack.example-coo-monitoring-stack.yaml Add the following
object configuration details:MonitoringStackExample
MonitoringStackobjectapiVersion: monitoring.rhobs/v1alpha1 kind: MonitoringStack metadata: name: example-coo-monitoring-stack namespace: ns1-coo spec: logLevel: debug retention: 1d resourceSelector: matchLabels: k8s-app: prometheus-coo-example-monitorApply the
object by running the following command:MonitoringStack$ oc apply -f example-coo-monitoring-stack.yamlVerify that the
object is available by running the following command and inspecting the output:MonitoringStack$ oc -n ns1-coo get monitoringstackExample output
NAME AGE example-coo-monitoring-stack 81m