1. Sending Telemetry Data Internally (Within the Cluster)
When sending telemetry data from applications or services within the Kubernetes cluster, you can leverage the cluster’s internal DNS to route data to the Sawmills Collector service.-
Send Data to the Sawmills Collector’s Internal DNS Address
Use the Sawmills Collector’s internal DNS address within the cluster. For example:sawmills-collector.sawmills.svc.cluster.local.
Kubernetes automatically manages this DNS for services, allowing pods to communicate with the Sawmills Collector by using this DNS name. -
Using Headless Services for Direct Pod Communication
For scenarios where you need direct communication with specific collector pods (e.g., load balancing, service discovery), you can use a headless service. For example:sawmills-collector-headless.sawmills.svc.cluster.local.
A headless service (ClusterIP: None) allows direct pod-to-pod communication and is particularly useful when you need to bypass the default load balancing behavior of Kubernetes services. -
Set the Collector’s Port
The Sawmills Collector typically listens on a specific port (e.g., 4317 for OTLP/gRPC). Ensure your application is configured to send data to the correct port on the collector. -
Verify Data Flow
Check that data is successfully flowing from your applications to the Sawmills Collector. The collector should receive, process, and potentially forward this data to a specified backend (e.g., Prometheus, Grafana) for further analysis.
2. Sending Telemetry Data Externally (Outside the Cluster)
If your data source is external to the Kubernetes cluster, you’ll need to expose the Sawmills Collector service to external traffic.Options to Expose the Collector:
- NodePort Service: A simpler method, mainly for testing purposes, exposing the service on a node’s IP address. Creating a NodePort Service You can use the following YAML to create a NodePort service that exposes the Sawmills Collector to external traffic:
- Kubernetes Ingress: Suitable for production, an ingress provides flexibility in routing external traffic to the collector service.
- Prerequisites
- An Ingress controller must be installed in your cluster (e.g., NGINX Ingress Controller or Traefik).
- A DNS entry pointing to your Ingress controller’s IP (or Load Balancer IP if you’re on a cloud provider).
- Example creates an Ingress resource that directs traffic from a specific external path (e.g.,
/sawmills) to the Sawmills Collector service.