Monitoring Horizontal Pod Autoscaling in Kubernetes

Apache OTel Receiver

3 min

1. Review OTel receiver for Apache

Exercise Inspect the Apache receiver configuration

Inspect the YAML file ~/workshop/k3s/otel-apache.yaml and validate the contents using the following command:

bash
cat ~/workshop/k3s/otel-apache.yaml

This file contains the configuration for the OpenTelemetry agent to monitor the Apache deployment:

yaml
agent:
  config:
    receivers:
      receiver_creator:
        receivers:
          apache:
            rule: type == "port" && pod.name matches "apache" && port == 80
            config:
              endpoint: http://apache-hpa-svc.apache.svc.cluster.local/server-status?auto

2. Observation Rules in the OpenTelemetry config

The file above contains an observation rule for Apache using the OTel receiver_creator. This receiver can instantiate other receivers at runtime based on whether observed endpoints match a configured rule.

The configured rules are evaluated for each endpoint discovered. If the rule evaluates to true, then the receiver for that rule is started as configured against the matched endpoint.

In this configuration, we tell the OpenTelemetry agent to look for Pods whose name matches apache and that expose port 80. Once found, the agent starts an Apache receiver to scrape metrics from the configured Kubernetes DNS URL (/server-status?auto).

Exercise Upgrade the Collector with the Apache receiver

Upgrade the existing Splunk OpenTelemetry Collector Helm release to include otel-apache.yaml:

bash
helm upgrade splunk-otel-collector --version 0.165.0 \
--set="splunkObservability.realm=$REALM" \
--set="splunkObservability.accessToken=$ACCESS_TOKEN" \
--set="clusterName=$INSTANCE-k3s-cluster" \
--set="splunkPlatform.endpoint=$HEC_URL" \
--set="splunkPlatform.token=$HEC_TOKEN" \
--set="splunkPlatform.index=splunk4rookies-workshop" \
splunk-otel-collector-chart/splunk-otel-collector \
-f ~/workshop/k3s/otel-collector.yaml \
-f ~/workshop/k3s/otel-apache.yaml

NOTE

The REVISION number of the deployment has changed, which is a helpful way to keep track of your changes.

text
Release "splunk-otel-collector" has been upgraded. Happy Helming!
NAME: splunk-otel-collector
LAST DEPLOYED: Mon Nov  4 14:56:25 2024
NAMESPACE: default
STATUS: deployed
REVISION: 2
TEST SUITE: None
NOTES:
Splunk OpenTelemetry Collector is installed and configured to send data to Splunk Platform endpoint "https://http-inputs-workshop.splunkcloud.com:443/services/collector/event".

Splunk OpenTelemetry Collector is installed and configured to send data to Splunk Observability realm eu0.

3. Kubernetes ConfigMaps

A ConfigMap is an object in Kubernetes consisting of key-value pairs that can be injected into your application. With a ConfigMap, you can separate configuration from your Pods and avoid hardcoding non-sensitive configuration data.

The OpenTelemetry collector uses ConfigMaps to store the configuration of the agent and the K8s Cluster receiver.

Exercise Verify the updated ConfigMap

List the ConfigMaps in the default namespace:

bash
kubectl get cm

Quick check

How many ConfigMaps are created by the Splunk OpenTelemetry Collector chart?

Inspect the otel-agent ConfigMap in YAML format:

bash
kubectl get cm splunk-otel-collector-otel-agent -o yaml

NOTE

The option -o yaml outputs the content of the ConfigMap in a readable YAML format.

Quick check

Where does the configuration from otel-apache.yaml appear inside the otel-agent ConfigMap?

Last Modified ·

Report an issue