Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit 32cbe66

Browse files
Merge pull request #2248 from splunk/urbiz-OD6444-collector-k8s-tls
[6444]: Collector for K8s - TLS config
2 parents 23e7d82 + f8266e0 commit 32cbe66

File tree

6 files changed

+319
-201
lines changed

6 files changed

+319
-201
lines changed

gdi/opentelemetry/collector-kubernetes/collector-configuration-tutorial-k8s/about-collector-config-tutorial.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _about-collector-configuration-tutorial-k8s:
22

33
*****************************************************************************************
4-
Tutorial: Configure the Splunk Distribution of OpenTelemetry Collector on Kubernetes
4+
Tutorial: Configure the Splunk Distribution of the OpenTelemetry Collector on Kubernetes
55
*****************************************************************************************
66

77
.. meta::
@@ -14,7 +14,7 @@ Tutorial: Configure the Splunk Distribution of OpenTelemetry Collector on Kubern
1414
collector-config-tutorial-start
1515
collector-config-tutorial-edit
1616

17-
The Splunk Distribution of OpenTelemetry Collector is a :new-page:`distribution <https://docs.splunk.com/Splexicon:Distribution>` of the OpenTelemetry Collector that includes components, installers, and default settings so that it's ready to work with Splunk Observability Cloud.
17+
The Splunk Distribution of the OpenTelemetry Collector is a :new-page:`distribution <https://docs.splunk.com/Splexicon:Distribution>` of the OpenTelemetry Collector that includes components, installers, and default settings so that it's ready to work with Splunk Observability Cloud.
1818

1919
Follow this tutorial for a walkthrough of configuring the Splunk Distribution of OpenTelemetry Collector to collect telemetry in common situations.
2020

gdi/opentelemetry/collector-kubernetes/collector-configuration-tutorial-k8s/collector-config-tutorial-edit.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ Download the default :new-page:`values.yaml <https://github.com/signalfx/splunk-
2626

2727
Take a moment to read through the values.yaml file and examine its structure. Notice how each section configures the Collector for different targets, such as Splunk Observability Cloud and Splunk Cloud Platform. The comments in the file contain useful indications as to which values you can use and what's their effect.
2828

29-
3029
Configure the Splunk HEC endpoint and token
3130
============================================
3231

@@ -156,7 +155,10 @@ This completes the tutorial. You created a local Kubernetes cluster, configured
156155

157156
To learn more about the Collector installation and components, see the following resources:
158157

159-
- :ref:`otel-install-k8s`
160-
- :ref:`otel-kubernetes-config`
161-
- :ref:`splunk-hec-exporter`
158+
* :ref:`kubernetes-helm-architecture`
159+
* :ref:`otel-install-k8s`
160+
* :ref:`otel-kubernetes-config`
161+
* :ref:`kubernetes-config-add`
162+
* :ref:`splunk-hec-exporter`
163+
162164

gdi/opentelemetry/collector-kubernetes/collector-kubernetes-intro.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ Get started with the Collector for Kubernetes
1818
Install with YAML manifests <install-k8s-manifests.rst>
1919
Kubernetes (EKS Add-on) <install-k8s-addon-eks.rst>
2020
Configure with Helm <kubernetes-config.rst>
21-
Advanced config <kubernetes-config-advanced.rst>
21+
Add components and data sources <kubernetes-config-add.rst>
2222
Configure logs and events <kubernetes-config-logs.rst>
23+
Advanced configuration <kubernetes-config-advanced.rst>
2324
Default Kubernetes metrics <metrics-ootb-k8s.rst>
2425
Upgrade <kubernetes-upgrade.rst>
2526
Uninstall <kubernetes-uninstall.rst>
@@ -55,12 +56,13 @@ Optionally, you can also:
5556
<h2>Configure the Collector for Kubernetes<a name="k8s-configure" class="headerlink" href="#k8s-configure" title="Permalink to this headline">¶</a></h2>
5657
</embed>
5758

58-
To configure the Collector, see:
59+
To configure the Collector, including adding additional components or activating automatic discovery, see:
5960

6061
* :ref:`otel-kubernetes-config`
61-
* :ref:`otel-kubernetes-config-advanced`
62-
* :ref:`kubernetes-config-logs`
62+
* :ref:`kubernetes-config-add`
6363
* :ref:`discovery-mode-k8s`
64+
* :ref:`kubernetes-config-logs`
65+
* :ref:`otel-kubernetes-config-advanced`
6466

6567
.. raw:: html
6668

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
.. _kubernetes-config-add:
2+
3+
**********************************************************************************************
4+
Configure the Collector for Kubernetes with Helm: Add components and data sources
5+
**********************************************************************************************
6+
7+
.. meta::
8+
:description: Optional configurations for the Splunk Distribution of OpenTelemetry Collector for Kubernetes: Add components or new data sources.
9+
10+
Read on to learn how to add additional components or data sources to your Collector for Kubernetes config.
11+
12+
For other config options, see:
13+
14+
* :ref:`otel-kubernetes-config`
15+
* :ref:`discovery-mode-k8s`
16+
* :ref:`kubernetes-config-logs`
17+
* :ref:`otel-kubernetes-config-advanced`
18+
19+
For a practical example of how to configure the Collector for Kubernetes see :ref:`about-collector-configuration-tutorial-k8s`.
20+
21+
.. _otel-kubernetes-config-add-components:
22+
23+
Add additional components to the configuration
24+
======================================================
25+
26+
To use any additional OTel component, integration or legacy monitor, add it the relevant configuration sections in the values.yaml file. Depending on your requirements, you might want to include it in the ``agent.config`` or the ``clusterReceiver.config`` section of the values.yaml. See more at :ref:`helm-chart-components`.
27+
28+
For a full list of available components and how to configure them, see :ref:`otel-components`. For a list of available application integrations, see :ref:`monitor-data-sources`.
29+
30+
How to collect data: agent or cluster receiver?
31+
-----------------------------------------------------------------------------
32+
33+
Read the following table to decide which option to chose to collect your data:
34+
35+
.. list-table::
36+
:header-rows: 1
37+
:width: 100%
38+
:widths: 20 40 40
39+
40+
* -
41+
- Collect via the Collector agent
42+
- Collect via the Collector cluster receiver
43+
44+
* - Where is data collected?
45+
- At the node level.
46+
- At the Kubernetes service level, through a single point.
47+
48+
* - Advantages
49+
- * Granularity: This option ensures that you capture the complete picture of your cluster's performance and health.
50+
* Fault tolerance: If a node becomes isolated or experiences issues, its metrics are still being collected independently. This gives you visibility into problems affecting individual nodes.
51+
- Simplicity: This option simplifies the setup and management.
52+
53+
* - Considerations
54+
- Complexity: Managing and configuring agents on each node can increase operational complexity, specifically agent config file management.
55+
- Uncomplete data: This option might result in a partial view of your cluster's health and performance. If the service collects metrics only from a subset of nodes, you might miss critical metrics from parts of your cluster.
56+
57+
* - Use cases
58+
- - Use this in environments where you need detailed insights into each node's operations. This allows better issue diagnosing and optimizing performance.
59+
- Use this to collect metrics from application pods that have multiple replicas that can be running on multiple nodes.
60+
- Use this in environments where operational simplicity is a priority, or if your cluster is already simple and has only 1 node.
61+
62+
Example: Add the MySQL receiver
63+
-----------------------------------------------------------------------------
64+
65+
This example shows how to add the :ref:`mysql-receiver` to your configuration file.
66+
67+
Add the MySQL receiver in the ``agent`` section
68+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69+
70+
To use the Collector agent daemonset to collect ``mysql`` metrics from every node the agent is deployed to, add this to your configuration:
71+
72+
.. code:: yaml
73+
74+
agent:
75+
config:
76+
receivers:
77+
mysql:
78+
endpoint: localhost:3306
79+
...
80+
81+
Add the MySQL receiver in the ``clusterReceiver`` section
82+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
83+
84+
To use the Collector cluster receiver deployment to collect ``mysql`` metrics from a single endpoint, add this to your configuration:
85+
86+
.. code:: yaml
87+
88+
clusterReceiver:
89+
config:
90+
receivers:
91+
mysql:
92+
endpoint: mysql-k8s-service:3306
93+
...
94+
95+
Example: Add the Rabbit MQ monitor
96+
-----------------------------------------------------------------------------
97+
98+
This example shows how to add the :ref:`rabbitmq` integration to your configuration file.
99+
100+
Add RabbitMQ in the ``agent`` section
101+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
102+
103+
If you want to activate the RabbitMQ monitor in the Collector agent daemonset, add ``mysql`` to the ``receivers`` section of your agent section in the configuration file:
104+
105+
.. code:: yaml
106+
107+
agent:
108+
config:
109+
receivers:
110+
smartagent/rabbitmq:
111+
type: collectd/rabbitmq
112+
host: localhost
113+
port: 5672
114+
username: otel
115+
password: ${env:RABBITMQ_PASSWORD}
116+
117+
Next, include the receiver in the ``metrics`` pipeline of the ``service`` section of your configuration file:
118+
119+
.. code:: yaml
120+
121+
service:
122+
pipelines:
123+
metrics:
124+
receivers:
125+
- smartagent/rabbitmq
126+
127+
Add RabbitMQ in the ``clusterReceiver`` section
128+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
129+
130+
Similarly, if you want to activate the RabbitMQ monitor in the cluster receiver, add ``mysql`` to the ``receivers`` section of your cluster receiver section in the configuration file:
131+
132+
.. code:: yaml
133+
134+
clusterReceiver:
135+
config:
136+
receivers:
137+
smartagent/rabbitmq:
138+
type: collectd/rabbitmq
139+
host: rabbitmq-service
140+
port: 5672
141+
username: otel
142+
password: ${env:RABBITMQ_PASSWORD}
143+
144+
Next, include the receiver in the ``metrics`` pipeline of the ``service`` section of your configuration file:
145+
146+
.. code:: yaml
147+
148+
service:
149+
pipelines:
150+
metrics:
151+
receivers:
152+
- smartagent/rabbitmq
153+
154+
Activate discovery mode on the Collector
155+
============================================
156+
157+
Use the discovery mode of the Splunk Distribution of OpenTelemetry Collector to detect metric sources and create
158+
a configuration based on the results.
159+
160+
See :ref:`discovery-mode-k8s` for instructions on how to activate discovery mode in the Helm chart.
161+
162+
.. _otel-kubernetes-config-resources:
163+
164+
Add additional telemetry sources
165+
===========================================
166+
167+
Use the ``autodetect`` configuration option to activate additional telemetry sources.
168+
169+
Set ``autodetect.prometheus=true`` if you want the Collector to scrape Prometheus metrics from pods that have generic Prometheus-style annotations. Add the following annotations on pods to allow a fine control of the scraping process:
170+
171+
* ``prometheus.io/scrape: true``: The default configuration scrapes all pods. If set to ``false``, this annotation excludes the pod from the scraping process.
172+
* ``prometheus.io/path``: The path to scrape the metrics from. The default value is ``/metrics``.
173+
* ``prometheus.io/port``: The port to scrape the metrics from. The default value is ``9090``.
174+
175+
If the Collector is running in an Istio environment, set ``autodetect.istio=true`` to make sure that all traces, metrics, and logs reported by Istio are collected in a unified manner.
176+
177+
For example, use the following configuration to activate automatic detection of both Prometheus and Istio telemetry sources:
178+
179+
.. code-block:: yaml
180+
181+
splunkObservability:
182+
accessToken: xxxxxx
183+
realm: us0
184+
clusterName: my-k8s-cluster
185+
autodetect:
186+
istio: true
187+
prometheus: true
188+
189+
.. _otel-kubernetes-deactivate-telemetry:
190+
191+
Deactivate particular types of telemetry
192+
============================================
193+
194+
By default, OpenTelemetry sends only metrics and traces to Splunk Observability Cloud and sends only logs to Splunk Platform. You can activate or deactivate any kind of telemetry data collection for a specific destination.
195+
196+
For example, the following configuration allows the Collector to send all collected telemetry data to Splunk Observability Cloud and the Splunk Platform if you've properly configured them:
197+
198+
.. code-block:: yaml
199+
200+
splunkObservability:
201+
metricsEnabled: true
202+
tracesEnabled: true
203+
logsEnabled: true
204+
splunkPlatform:
205+
metricsEnabled: true
206+
logsEnabled: true
207+

gdi/opentelemetry/collector-kubernetes/kubernetes-config-advanced.rst

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ The following table shows which Kubernetes distributions support control plane m
7575

7676
.. list-table::
7777
:header-rows: 1
78-
:width: 60%
78+
:width: 100%
79+
:widths: 50 50
7980

8081
* - Supported
8182
- Unsupported
@@ -134,6 +135,7 @@ The following example shows how to connect to a nonstandard API server that uses
134135
useHTTPS: true
135136
useServiceAccount: false
136137
138+
.. _kubernetes-config-advanced-non-root:
137139

138140
Run the container in non-root user mode
139141
==================================================
@@ -151,6 +153,91 @@ To run the container in ``non-root`` user mode, use ``agent.securityContext`` to
151153
152154
.. note:: Running the collector agent for log collection in non-root mode is not currently supported in CRI-O and OpenShift environments at this time. For more details, see the :new-page:`related GitHub feature request issue <https://github.com/signalfx/splunk-otel-collector-chart/issues/891>`.
153155

156+
.. _kubernetes-config-advanced-tls-certificates:
157+
158+
Configure custom TLS certificates
159+
==================================================
160+
161+
If your organization requires custom TLS certificates for secure communication with the Collector, follow these steps:
162+
163+
1. Create a Kubernetes secret containing the Root CA certificate, TLS certificate, and private key files
164+
---------------------------------------------------------------------------------------------------------------------
165+
166+
Store your custom CA certificate, key, and cert files in a Kubernetes secret in the same namespace as the your Splunk Helm chart.
167+
168+
For example, you can run this command:
169+
170+
.. code-block:: bash
171+
172+
kubectl create secret generic my-custom-tls --from-file=ca.crt=/path/to/custom_ca.crt --from-file=apiserver.key=/path/to/custom_key.key --from-file=apiserver.crt=/path/to/custom_cert.crt -n <namespace>
173+
174+
.. Note:: You are responsible for externally managing this secret, which is not part of the Splunk Helm chart deployment.
175+
176+
2. Mount the secret in the Splunk Helm Chart
177+
-----------------------------------------------------------------------------
178+
179+
Apply this configuration to the ``agent``, ``clusterReceiver``, or ``gateway`` using the following Helm values:
180+
181+
* ``agent.extraVolumes``, ``agent.extraVolumeMounts``
182+
* ``clusterReceiver.extraVolumes``, ``clusterReceiver.extraVolumeMounts``
183+
* ``gateway.extraVolumes``, ``gateway.extraVolumeMounts``
184+
185+
Learn more about Helm components at :ref:`helm-chart-components`.
186+
187+
For example:
188+
189+
.. code-block:: yaml
190+
191+
agent:
192+
extraVolumes:
193+
- name: custom-tls
194+
secret:
195+
secretName: my-custom-tls
196+
extraVolumeMounts:
197+
- name: custom-tls
198+
mountPath: /etc/ssl/certs/
199+
readOnly: true
200+
201+
clusterReceiver:
202+
extraVolumes:
203+
- name: custom-tls
204+
secret:
205+
secretName: my-custom-tls
206+
extraVolumeMounts:
207+
- name: custom-tls
208+
mountPath: /etc/ssl/certs/
209+
readOnly: true
210+
211+
gateway:
212+
extraVolumes:
213+
- name: custom-tls
214+
secret:
215+
secretName: my-custom-tls
216+
extraVolumeMounts:
217+
- name: custom-tls
218+
mountPath: /etc/ssl/certs/
219+
readOnly: true
220+
221+
3. Override your TLS configuration
222+
-----------------------------------------------------------------------------
223+
224+
Update the TLS configuration for specific Collector components, such as the agent's ``kubeletstatsreceiver``, to use the mounted certificate, key, and CA files.
225+
226+
For example:
227+
228+
.. code-block:: yaml
229+
230+
agent:
231+
config:
232+
receivers:
233+
kubeletstats:
234+
auth_type: "tls"
235+
ca_file: "/etc/ssl/certs/custom_ca.crt"
236+
key_file: "/etc/ssl/certs/custom_key.key"
237+
cert_file: "/etc/ssl/certs/custom_cert.crt"
238+
insecure_skip_verify: true
239+
240+
.. note:: To skip certificate checks, you can disable secure TLS checks per component. This option is not recommended for production environments due to security standards.
154241

155242
Collect network telemetry using eBPF
156243
==================================================

0 commit comments

Comments
 (0)