Skip to content

dynatrace-extensions/etcd-for-k8s-control-plane

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

etcd for OpenShift

This extension provides you with deep insights into your self-managed OpenShift control plane using etcd metrics exposed on your cluster in the Prometheus/OpenMetrics format. It provides an out-of-the-box dashboard and pre-configured alerts. To give you a brief impression what you get with this extension, have a look at the screenshots below. Of course, you can also build your own dashboards and metric events for alerting based on the metrics exposed by etcd.

Screenshots

Dashboard No leader event Frequent leader changes event
screenshot dashboard 1 screenshot alert 1 screenshot alert 2

Prerequisites and supported versions

  • Dynatrace version 1.242+
  • ActiveGate version 1.222+ running within the Kubernetes cluster and Kubernetes connection settings set to "Connecting containerized ActiveGate to local Kubernetes API endpoint". To have an ActiveGate in your Kubernetes cluster, deploy Dynatrace using Dynatrace Operator (recommended) or deploy an ActiveGate as a StatefulSet.
  • OpenShift 4 and OpenShift 3 (self-managed)
  • Granted permission to 'configmaps/get' and 'secrets/get' for the service account used for Kubernetes API monitoring (typically, dynatrace-kubernetes-monitoring)

Install extension

Follow the steps to install the etcd for OpenShift extension.

1. Enable Prometheus monitoring in Dynatrace

In your Dynatrace environment, go to Kubernetes, edit your Kubernetes cluster settings, and turn on Enable monitoring and Monitor annotated Prometheus exporters. For more information see our official documentation.

2. Start ingesting etcd metrics

To ingest metrics exposed by etcd, the related service needs to be annotated with specific Dynatrace annotations. Based on the used OpenShift version, use the corresponding instructions below. Before executing any of the instructions below, ensure your kubectl is configured to use the Kubernetes cluster you want to monitor.

OpenShift 4

kubectl annotate --overwrite service etcd -n openshift-etcd \
metrics.dynatrace.com/port='9979' metrics.dynatrace.com/scrape='true' metrics.dynatrace.com/secure='true' \
metrics.dynatrace.com/tls.ca.crt='configmap:openshift-config:etcd-metric-serving-ca:ca-bundle.crt' \
metrics.dynatrace.com/tls.crt='secret:openshift-config:etcd-metric-client:tls.crt' \
metrics.dynatrace.com/tls.key='secret:openshift-config:etcd-metric-client:tls.key'

OpenShift 3

For OpenShift 3, the required TLS files need to be created and stored in secrets - creating the same situation that is the default for OpenShift 4. To achieve this easily, we provide a script that follows the official documentation of OpenShift. For executing the script, download the script itself and the dynatrace-monitoring-etcd-ocp3-service.yaml file. Store both files in a single folder and execute the activate_etcd_scraping_ocp3.sh script.

Verification and troubleshooting

After some minutes, you can verify if everything works as expected by finding etcd related metrics using Dynatrace metrics browser. etcd metrics are prefixed with etcd_ string, for example etcd_server_has_leader.

etcd metrics

For troubleshooting and further annotation methods, see Monitor Prometheus metrics in Dynatrace documentation.

3. Install the extension package

To get the out-of-the-box dashboard and pre-configured alerts included in this extension, navigate to the Dynatrace Hub within Dynatrace and search for "etcd". Select the "etcd for OpenShift" tile and follow the on-screen guidance to activate the extension. After activating the extension, select Dashboards in Dynatrace. You should now find an out-of-the-box etcd for OpenShift dashboard.

list of dashboards

4. Activate metric events for alerting

Additionally, the extension comes with the two pre-configured metric events for alerting. To activate them:

  1. From the Dynatrace navigation menu, select Settings > Anomaly detection > Custom events for alerting.

  2. Find the following events

    list of alerts

    • etcd for OpenShift: member has no leader: notifies you if any etcd member does not have a leader. Per default, this event immediately triggers as soon as any etcd member is missing a leader.
    • etcd for OpenShift: frequent leader changes: checks for frequent leader changes within etcd. Per default, this event triggers if any etcd member observes more than one leader change within an hour.
  3. If necessary, select the Edit button to customize the event conditions.

  4. Move the switch next an event to the On position to activate it.

Uninstall the extension

1. Stop metric ingest

As metric ingest is subject to DDU consumption, it is important to stop it by removing the annotations from the etcd service. If you followed the instructions described in the "Start ingesting etcd metrics" section, you can use kubectl to remove the annotations.

OpenShift 4

kubectl annotate service etcd -n openshift-etcd \
metrics.dynatrace.com/port- metrics.dynatrace.com/scrape- metrics.dynatrace.com/secure- \
metrics.dynatrace.com/tls.ca.crt- metrics.dynatrace.com/tls.crt- metrics.dynatrace.com/tls.key-

OpenShift 3

kubectl delete configmap etcd-data -n dynatrace
kubectl delete secret etcd-data -n dynatrace
kubectl delete service dynatrace-monitoring-etcd-ocp3 -n kube-system

2. Deactivate the extension

To remove the out-of-the-box dashboard and alerts, deactivate the extension via the Dynatrace Hub.