> For the complete documentation index, see [llms.txt](https://docs.cennso.com/cennso/monitoring/latest/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/cennso/monitoring/latest/troubleshooting/common-issues.md).

# Common Issues

This document describes common configuration issues when creating and running exporters with the Monitoring Extension and how to resolve them.

## Telegraf pod not starting — missing or misnamed Secret keys

**Symptom:** The Telegraf pod starts but immediately exits, or logs show errors such as `failed to load config` or `environment variable ... not set`.

**Cause:** The OAuth2 credentials Secret referenced by `spec.sink.elastic.auth.oauth2.secretRef.name` is missing, is in the wrong namespace, or does not contain all four required keys: `client_id`, `client_secret`, `token_endpoint`, `api_endpoint`.

**Resolution:**

1. Confirm the Secret exists in the same namespace as the `Exporter`:

   ```bash
   kubectl get secret {SECRET_NAME} -n {NAMESPACE}
   ```

2. Verify all four keys are present:

   ```bash
   kubectl get secret {SECRET_NAME} -n {NAMESPACE} \
     -o jsonpath='{.data}' | python3 -m json.tool
   ```

3. If any key is missing, recreate the Secret with the correct keys.

---

## metricsURL not set — Telegraf connects to the wrong source

**Symptom:** Telegraf starts but collects no useful metrics, or logs `connection refused` / `no such host` against `mimir-gateway.cennso-monitoring`.

**Cause:** When `spec.source.metricsURL` is omitted, the composition defaults to `http://mimir-gateway.cennso-monitoring/prometheus`. If this address does not resolve in your cluster, or points to a different Mimir instance than intended, metrics collection fails silently.

**Resolution:** Set `spec.source.metricsURL` explicitly on the `Exporter` CR:

```yaml
spec:
  source:
    metricsURL: http://mimir-gateway.cennso-monitoring/prometheus
```

---

## Unauthorized (401) from the Elasticsearch endpoint

**Symptom:** Telegraf logs repeat `401 Unauthorized` errors against the Elasticsearch endpoint, or the `Authorization` header value reads `Bearer @{cennso_oauth:access_token}` verbatim (the reference was not resolved).

**Cause:** The OAuth2 token request is failing (wrong credentials, wrong endpoint, wrong scopes), or the `secretstores.oauth2` plugin could not expand the secret reference.

**Resolution:**

1. Confirm the token endpoint is reachable from the pod and that `client_id` and `client_secret` are correct.

2. If the `Authorization` header shows the unresolved reference verbatim, verify that the Telegraf `secretstores.oauth2` block is present in the rendered ConfigMap:

   ```bash
   kubectl get configmap {EXPORTER_NAME}-telegraf-conf -n {NAMESPACE} \
     -o jsonpath='{.data.telegraf\.conf}' | grep secretstores
   ```

   If the `secretstores` section is missing, the `Exporter` CR may be missing the `spec.sink.elastic.auth.oauth2` block.

---

## Helm Release not created on first install

**Symptom:** The `Exporter` CR is `SYNCED=True` and the ConfigMap is created, but the Helm Release does not appear immediately.

**Cause:** This is expected behavior. The `sequence-creation` step withholds the Helm Release from the desired state until the ConfigMap Object is `Ready`. On the first reconcile cycle the ConfigMap Object has just been created and its `Ready` condition has not been reported yet, so the sequencer delays the Release by one cycle. The Release is created on the next reconcile once the Kubernetes provider confirms the ConfigMap is ready.

**Resolution:** Wait one reconcile cycle (usually a few seconds). Run `kubectl get exporter {EXPORTER_NAME} -n {NAMESPACE}` again; the Release appears once the ConfigMap Object reports `Ready=True`.

---

## Exporter stuck in Pending or not synced

**Symptom:** `kubectl get exporter` shows `SYNCED=False` or `READY=False`, and the Helm Release or ConfigMap is not created.

**Cause:** One of the composition functions or providers may be unhealthy, or the `Exporter` CR may have a validation error.

**Resolution:**

1. Check the `Exporter` conditions for details:

   ```bash
   kubectl describe exporter {EXPORTER_NAME} -n {NAMESPACE}
   ```

2. Verify all Crossplane functions and providers are installed and healthy:

   ```bash
   kubectl get functions.pkg.crossplane.io
   kubectl get providers.pkg.crossplane.io
   ```

3. Check Crossplane controller logs for reconciliation errors:

   ```bash
   kubectl logs -n crossplane-system -l app=crossplane --tail=50
   ```
