Skip to content

Commit

Permalink
Add troubleshooting step for config map newlines (#674)
Browse files Browse the repository at this point in the history
Signed-off-by: Pete Wall <pete.wall@grafana.com>
  • Loading branch information
petewall authored Aug 5, 2024
1 parent 609d2ee commit ff7a362
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions charts/k8s-monitoring/docs/Troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This document contains some information about frequently encountered issues and
- [Pod log files in `/var/lib/docker/containers`](#pod-log-files-in-varlibdockercontainers)
- [Authentication error: invalid scope requested](#authentication-error-invalid-scope-requested)
- [Kepler pods crashing on AWS Graviton nodes](#kepler-pods-crashing-on-aws-graviton-nodes)
- [ConfigMaps show `\n` and not newlines](#configmaps-show-n-and-not-newlines)

## General tips

Expand Down Expand Up @@ -115,3 +116,26 @@ kepler:
nodeSelector:
kubernetes.io/arch: amd64
```

### ConfigMaps show `\n` and not newlines

If you see `\n` in the ConfigMaps instead of newlines, it's likely due to extra newlines in the config file. See
[this issue](https://github.com/kubernetes/kubernetes/issues/36222) for details. An example:

```yaml
apiVersion: v1
data:
config.alloy: "discovery.kubernetes \"nodes\" {\n role = \"node\"\n}\n\ndiscovery.kubernetes
\"services\" {\n role = \"service\"\n}\n\ndiscovery.kubernetes \"endpoints\"
{\n role = \"endpoints\"\n}\n\ndiscovery.kubernetes \"pods\" {\n role = \"pod\"\n}\n\n//
OTLP Receivers\notelcol.receiver.otlp \"receiver\" {\n grpc {\n endpoint =
```

To fix this, ensure that any multi-line configuration blocks in your values file use `|-` instead of `|`. For example:

```yaml
metrics:
kube-state-metrics:
extraMetricRelabelingRules: |- # Make sure to use |- here
rule {...}
```

0 comments on commit ff7a362

Please sign in to comment.