// This assembly is included in the following assemblies:
//
// metrics/assembly_metrics-kafka.adoc

[id='proc-metrics-kafka-deploy-options-{context}']
= Deploying Prometheus metrics configuration

Strimzi provides xref:ref-metrics-yaml-files-{context}[example custom resource configuration YAML files] with relabeling rules.

To apply metrics configuration of relabeling rules, do one of the following:

* xref:proc-metrics-kafka-{context}[Copy the example configuration to your own custom resource definition]
* xref:proc-metrics-deploying-kafka-{context}[Deploy the custom resource with the metrics configuration]

[id='proc-metrics-kafka-{context}']
== Copying Prometheus metrics configuration to a custom resource

To use Grafana dashboards for monitoring, copy xref:ref-metrics-yaml-files-{context}[the example metrics configuration to a custom resource].

In this procedure, the `Kafka` resource is updated, but the procedure is the same for all components that support monitoring.

.Procedure
Perform the following steps for each `Kafka` resource in your deployment.

. Update the `Kafka` resource in an editor.
+
[source,shell,subs="+quotes,attributes"]
----
kubectl edit kafka _KAFKA-CONFIG-FILE_
----

. Copy the xref:ref-metrics-yaml-files-{context}[example configuration in `kafka-metrics.yaml`] to your own `Kafka` resource definition.
. Save the file, and wait for the updated resource to be reconciled.

[id='proc-metrics-deploying-kafka-{context}']
== Deploying a Kafka cluster with Prometheus metrics configuration

To use Grafana dashboards for monitoring, you can deploy xref:ref-metrics-config-files-{context}[an example Kafka cluster with metrics configuration].

In this procedure, The `kafka-metrics.yaml` file is used for the `Kafka` resource.

.Procedure

* Deploy the Kafka cluster with the xref:ref-metrics-yaml-files-{context}[example metrics configuration].
+
[source,shell,subs="+attributes"]
----
kubectl apply -f kafka-metrics.yaml
----
