Help Center/ Cloud Container Engine/ User Guide/ Observability/ Best Practices/ Cloud Native Cluster Monitoring Is Compatible with Self-Built Prometheus
Updated on 2024-11-12 GMT+08:00

Cloud Native Cluster Monitoring Is Compatible with Self-Built Prometheus

Compatibility Mode of Cloud Native Cluster Monitoring

  • If you have deployed Prometheus and your Prometheus is open-source and has not been deeply customized or integrated with your monitoring system, you are advised to uninstall it and use the Cloud Native Cluster Monitoring add-on instead. By doing so, you do not need to enable Compatibility Mode.

    To uninstall your self-built Prometheus, ensure that all workloads of your self-built Prometheus and all CRDs ending with monitoring.coreos.com are deleted. For details, see How Do I Delete Self-Built Prometheus?.

  • If your self-built Prometheus cannot be uninstalled and you need to use functions such as Cost Insights and Monitoring Center, you can enable Compatibility Mode when your self-built Prometheus meets Compatibility Requirements. For details, see Enabling Cluster Monitoring.

    The compatibility mode does not support all functions of the Cloud Native Cluster Monitoring add-on. For details, see Restrictions on the Compatibility Mode.

Compatibility Requirements

Ensure that your self-built Prometheus meets the following requirements, or it cannot run normally.

  • If your Prometheus is not based on kube-prometheus of the Operator community, the compatibility requirements are met.
  • If your Prometheus is based on kube-prometheus of the Operator community, the prometheuses.monitoring.coreos.com version must be 0.8.0 or later.

    You can run the following command in the cluster to check the version:

    kubectl get crd prometheuses.monitoring.coreos.com -oyaml | grep controller-gen.kubebuilder.io/version

    If the following information is displayed, the compatibility requirements are met:

    Error from server (NotFound): customresourcedefinitions.apiextensions.k8s.io "prometheuses.monitoring.coreos.com" not found

    If the following information is displayed and the version is 0.8.0 or later, the compatibility requirements are met:

    controller-gen.kubebuilder.io/version: v0.9.2

Restrictions on the Compatibility Mode

  • In compatibility mode, the Cloud Native Cluster Monitoring add-on is installed in the cce-monitoring namespace. By default, the ServiceMonitor and PodMonitor of another namespace are not identified.
  • The Cloud Native Cluster Monitoring add-on can only be deployed without local data storage.
  • You cannot disable compatibility mode once it is enabled. To use the normal mode, you can uninstall the Cloud Native Cluster Monitoring add-on first and install it again.
  • Currently, cost optimization is not supported.
  • Currently, metrics discarding on the AOM page is not supported.
  • Currently, the ServiceMonitor and PodMonitor cannot be started or stopped on the AOM page.

How Do I Delete Self-Built Prometheus?

  1. Delete all workloads, services, and other resources related to self-built Prometheus, such as DaemonSets, Deployments, StatefulSets, and Services. Generally, these resources are in the monitoring namespace. Replace it with the actual namespace used during the add-on installation.
  2. Query all CRDs ending with monitoring.coreos.com.

    kubectl get crd | grep monitoring.coreos.com | awk '{print $1}' | xargs

    If the command output is empty, no further action is required.

  3. Delete all CRDs ending with monitoring.coreos.com.

    kubectl delete crd $(kubectl get crd | grep monitoring.coreos.com | awk '{print $1}' | xargs)