Collect Telemetry Data from External Clients to Kafka¶
Stream telemetry data from external client nodes to the Omnia Kafka pipeline in the Service Kubernetes cluster using mutual TLS (mTLS).
Overview¶
This procedure describes how to collect telemetry data from external client nodes and stream it to Kafka deployed in the Service Kubernetes cluster. Kafka is deployed via Strimzi in the telemetry namespace. External clients authenticate with the Kafka broker using mutual TLS (mTLS) certificates.
Prerequisites¶
This is a post-deployment procedure. The Omnia telemetry stack (including Kafka) must already be deployed and running before you connect external clients.
- A Service Kubernetes cluster is running with Kafka deployed via Strimzi in the
telemetrynamespace. - External access to Kafka is available through a LoadBalancer on port
9094. pod_external_ip_rangeis set inomnia_config.ymlso MetalLB can assign an external IP to the Kafka mTLS listener.- Kafka is deployed and operational in the telemetry namespace (enable a Kafka- backed telemetry source, such as iDRAC, LDMS, or OME, before deployment).
- A Kafka Pump is available outside the Service Kubernetes cluster, deployed as a container using Kubernetes, Podman, or Docker.
Procedure¶
Step 1: Create a Kafka Topic (Optional)¶
On the Service Kubernetes cluster, create a KafkaTopic resource using the Strimzi CRD:
-
Create a file named
kafka.<topic_name>.yaml:File: kafka.<topic_name>.yamlapiVersion: kafka.strimzi.io/v1beta2 kind: KafkaTopic metadata: name: my-new-topic namespace: telemetry labels: strimzi.io/cluster: kafka spec: partitions: 3 replicas: 3 topicName: my-new-topicReplace
my-new-topicwith the desired Kafka topic name. -
Apply the topic configuration file on the Service Kube Control Plane node:
Run on K8s control planekubectl apply -f kafka.<topic_name>.yaml -
Verify that the topic was created:
Run on K8s control planekubectl get kafkatopics -n telemetry
Step 2: Extract Kafka Connection Details and TLS Certificates¶
Run the following playbook to retrieve the Kafka connection details and TLS certificates from the Service Kubernetes cluster:
cd /omnia/utils
ansible-playbook external_kafka_connect_details.yml
The external_kafka_connect_details.yml playbook does the following:
- Retrieves the Kafka LoadBalancer external IP.
- Extracts the server CA certificate and client certificates/keys from the
telemetrynamespace. - Writes the Kafka endpoint and TLS file locations to
/opt/omnia/telemetry/external_kafka_connect_details.yml. - Saves the TLS files in
/opt/omnia/telemetry/external_kafka/:ca.crt(server certificate)user.crt(client certificate)user.key(client key)
Step 3: Create Client Certificate in .pfx Format¶
Create a client certificate in .pfx format for mTLS by running the following command. Provide a passphrase when prompted:
cd /opt/omnia/telemetry/external_kafka/
openssl pkcs12 -export -out user.pfx -inkey user.key -in user.crt
Note
For OpenManage Enterprise Kafka client, the client certificate must be in .pfx format. To configure OpenManage Enterprise to stream telemetry data to Kafka, see Collect Telemetry Data from OpenManage Enterprise.
Step 4: Create Java Truststore and Keystore (Optional)¶
The steps for converting certificates into JKS format are required only for Java-based Kafka clients. If your client does not use a Java keystore (JKS), these conversion steps are not necessary.
cd /opt/omnia/telemetry/external_kafka/
keytool -import -trustcacerts -alias kafka-ca -file ca.crt \
-keystore kafka.truststore.jks -storepass changeit -noprompt
openssl pkcs12 -export -in user.crt -inkey user.key \
-out kafkapump.p12 -name kafkapump -password pass:changeit
keytool -importkeystore \
-srckeystore kafkapump.p12 -srcstoretype PKCS12 -srcstorepass changeit \
-destkeystore kafka.keystore.jks -deststorepass changeit -noprompt
Step 5: Create Kafka Client SSL Configuration File¶
Create a properties file for the Kafka client:
security.protocol=SSL
ssl.truststore.location=/certs/kafka.truststore.jks
ssl.truststore.password=changeit
ssl.keystore.location=/certs/kafka.keystore.jks
ssl.keystore.password=changeit
ssl.key.password=changeit
ssl.endpoint.identification.algorithm=
Step 6: Run a Kafka Tools Container¶
Run a Kafka tools container with certificates mounted:
podman run -it --rm \
--name kafka-mtls-producer \
-v ~/kafka-mtls-test:/certs:Z \
apache/kafka:4.1.0 bash
Step 7: Produce and Verify Telemetry Data¶
-
To verify the available Kafka topics, run the following command:
Run inside Kafka tools containerKAFKA_LB_IP=<external load balancer IP of the bridge-bridge-lb service> /opt/kafka/bin/kafka-topics.sh \ --bootstrap-server $KAFKA_LB_IP:9094 \ --command-config /certs/producer-mtls.properties \ --list -
Inside the Kafka tools container, produce test data to the Kafka topic:
Run inside Kafka tools container/opt/kafka/bin/kafka-console-producer.sh \ --bootstrap-server $KAFKA_LB_IP:9094 \ --topic <kafka topic> \ --producer.config /certs/producer-mtls.propertiesType messages and press Enter after each. Sample data:
{"device_id": "xyz-001", "metric": "power", "value": 250, "timestamp": "2024-11-18T10:25:00Z"} {"device_id": "xyz-002", "metric": "temperature", "value": 25.5, "timestamp": "2024-11-18T10:25:10Z"} {"device_id": "xyz-003", "metric": "fan_speed", "value": 4500, "timestamp": "2024-11-18T10:25:20Z"}Press
Ctrl+Dto exit. -
In a new terminal, verify if the messages are received:
Run inside Kafka tools container/opt/kafka/bin/kafka-console-consumer.sh \ --bootstrap-server $KAFKA_LB_IP:9094 \ --consumer.config /certs/producer-mtls.properties \ --topic <kafka topic> \ --group <kafka topic>-consumer-group \ --from-beginningYou can view the messages in JSON format.
Next Steps¶
- Configure OpenManage Enterprise Telemetry (OME) -- Integrate OME with Kafka using mTLS.
- Setup Telemetry -- Overview of all telemetry sources.