grafana / helm-charts

Apache License 2.0
1.67k stars 2.28k forks source link

[grafana] k8s-sidecar warning: "No data/binaryData field in configmap" #2937

Open sczelo opened 10 months ago

sczelo commented 10 months ago

Grafana helm chart version: 7.2.4 Grafana version: 10.2.3 k8s-sidecar version: 1.25.2

I have two dashboard folder. One for the dashboards downloaded with gnetid automatically and one for the dashboards deployed in a configmap and loaded with the sidecar.

dashboards:
  gnetiddashboard:
    dboard1:
      gnetId: 2
      revision: 1
      datasource: Prometheus

The helm chart automatically generates configmap for the gnetid dashboard folder with empty data.

 apiVersion: v1
kind: ConfigMap
metadata:
  name: grafana-dashboards-gnetiddashboard
  namespace: grafana
  labels:
    helm.sh/chart: grafana-7.2.4
    app.kubernetes.io/name: grafana
    app.kubernetes.io/instance: grafana
    app.kubernetes.io/version: "10.2.3"
    app.kubernetes.io/managed-by: Helm
    dashboard-provider: gnetiddashboard
    grafana_dashboard: "1"
data:
  {}

After deploying the helm chart, in the sidecar container logs, I got the following warnings in every minute:

{"time": "2024-01-25T12:36:23.334598+00:00", "taskName": null, "msg": "No data/binaryData field in configmap", "level": "WARNING"}
{"time": "2024-01-25T12:37:28.350025+00:00", "taskName": null, "msg": "No data/binaryData field in configmap", "level": "WARNING"}
{"time": "2024-01-25T12:38:33.365032+00:00", "taskName": null, "msg": "No data/binaryData field in configmap", "level": "WARNING"}
{"time": "2024-01-25T12:39:38.382370+00:00", "taskName": null, "msg": "No data/binaryData field in configmap", "level": "WARNING"}
{"time": "2024-01-25T12:40:43.405637+00:00", "taskName": null, "msg": "No data/binaryData field in configmap", "level": "WARNING"}

I see the helm chart, that the data field only filled if there is a file or json in the values under the dashboard, but if I use the gnetid type there will be no data and the configmap is unnecessary.

LudoNieuwenhuizen commented 7 months ago

Same issue here!

I don't have any dashboards loaded from configmap that this container is using, so the WARN message confuses me. surrounding logs:

{"time": "2024-03-20T19:48:48.148320+00:00", "msg": "Starting collector", "level": "INFO"}
{"time": "2024-03-20T19:48:48.148465+00:00", "msg": "No folder annotation was provided, defaulting to k8s-sidecar-target-directory", "level": "WARNING"}
{"time": "2024-03-20T19:48:48.148631+00:00", "msg": "Loading incluster config ...", "level": "INFO"}
{"time": "2024-03-20T19:48:48.149302+00:00", "msg": "Config for cluster api at 'https://10.100.96.1:443' loaded...", "level": "INFO"}
{"time": "2024-03-20T19:48:48.149407+00:00", "msg": "Unique filenames will not be enforced.", "level": "INFO"}
{"time": "2024-03-20T19:48:48.149502+00:00", "msg": "5xx response content will not be enabled.", "level": "INFO"}
{"time": "2024-03-20T19:48:53.222044+00:00", "msg": "Writing /tmp/dashboards/default-api-dashboard.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:48:53.222631+00:00", "msg": "Writing /tmp/dashboards/fluentd-dashboard.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:48:53.223021+00:00", "msg": "Writing /tmp/dashboards/micrometer-dashboard.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:48:53.226218+00:00", "msg": "Retrying (Retry(total=4, connect=9, read=5, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f5cb5e47f50>: Failed to establish a new connection: [Errno 111] Connection refused')': /api/admin/provisioning/dashboards/reload", "level": "WARNING"}
{"time": "2024-03-20T19:48:55.426945+00:00", "msg": "Retrying (Retry(total=3, connect=8, read=5, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f5cb5e49410>: Failed to establish a new connection: [Errno 111] Connection refused')': /api/admin/provisioning/dashboards/reload", "level": "WARNING"}
{"time": "2024-03-20T19:48:57.274245+00:00", "msg": "No data/binaryData field in configmap", "level": "WARNING"}
{"time": "2024-03-20T19:48:57.275527+00:00", "msg": "Writing /tmp/dashboards/alertmanager-overview.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:48:57.529654+00:00", "msg": "Writing /tmp/dashboards/apiserver.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:48:57.762322+00:00", "msg": "Writing /tmp/dashboards/cluster-total.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:48:58.005783+00:00", "msg": "Writing /tmp/dashboards/grafana-overview.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:48:58.228533+00:00", "msg": "Writing /tmp/dashboards/k8s-coredns.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:48:58.492299+00:00", "msg": "Writing /tmp/dashboards/k8s-resources-cluster.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:48:58.737758+00:00", "msg": "Writing /tmp/dashboards/k8s-resources-multicluster.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:48:58.980536+00:00", "msg": "Writing /tmp/dashboards/k8s-resources-namespace.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:48:59.234559+00:00", "msg": "Writing /tmp/dashboards/k8s-resources-node.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:48:59.473349+00:00", "msg": "Writing /tmp/dashboards/k8s-resources-pod.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:48:59.709480+00:00", "msg": "Writing /tmp/dashboards/k8s-resources-workload.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:48:59.966961+00:00", "msg": "Writing /tmp/dashboards/k8s-resources-workloads-namespace.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:49:00.288733+00:00", "msg": "Writing /tmp/dashboards/kubelet.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:49:00.526186+00:00", "msg": "Writing /tmp/dashboards/namespace-by-pod.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:49:00.762628+00:00", "msg": "Writing /tmp/dashboards/namespace-by-workload.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:49:01.008555+00:00", "msg": "Writing /tmp/dashboards/node-cluster-rsrc-use.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:49:01.244881+00:00", "msg": "Writing /tmp/dashboards/node-rsrc-use.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:49:01.482503+00:00", "msg": "Writing /tmp/dashboards/nodes.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:49:01.715377+00:00", "msg": "Writing /tmp/dashboards/nodes-darwin.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:49:01.970381+00:00", "msg": "Writing /tmp/dashboards/persistentvolumesusage.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:49:02.209439+00:00", "msg": "Writing /tmp/dashboards/pod-total.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:49:02.455724+00:00", "msg": "Writing /tmp/dashboards/prometheus.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:49:02.706542+00:00", "msg": "Writing /tmp/dashboards/workload-total.json (ascii)", "level": "INFO"}
{"time": "2024-03-20T19:49:58.255779+00:00", "msg": "No data/binaryData field in configmap", "level": "WARNING"}
<...>
{"time": "2024-03-20T19:51:03.274997+00:00", "msg": "No data/binaryData field in configmap", "level": "WARNING"}
{"time": "2024-03-23T13:39:32.069272+00:00", "msg": "ProtocolError when calling kubernetes: (\"Connection broken: InvalidChunkLength(got length b'', 0 bytes read)\", InvalidChunkLength(got length b'', 0 bytes read))\n", "level": "ERROR"}
{"time": "2024-03-23T13:39:37.133777+00:00", "msg": "No data/binaryData field in configmap", "level": "WARNING"}
<...>
{"time": "2024-04-06T20:34:38.029701+00:00", "msg": "Received unknown exception: HTTPSConnectionPool(host='10.100.96.1', port=443): Read timed out.\n", "level": "ERROR"}
Traceback (most recent call last):
  File "/app/.venv/lib/python3.11/site-packages/urllib3/response.py", line 444, in _error_catcher
    yield
  File "/app/.venv/lib/python3.11/site-packages/urllib3/response.py", line 828, in read_chunked
    self._update_chunk_length()
  File "/app/.venv/lib/python3.11/site-packages/urllib3/response.py", line 758, in _update_chunk_length
    line = self._fp.fp.readline()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/socket.py", line 706, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/ssl.py", line 1311, in recv_into
    return self.read(nbytes, buffer)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/ssl.py", line 1167, in read
    return self._sslobj.read(len, buffer)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/resources.py", line 374, in _watch_resource_loop
    _watch_resource_iterator(*args)
  File "/app/resources.py", line 326, in _watch_resource_iterator
    for event in stream:
  File "/app/.venv/lib/python3.11/site-packages/kubernetes/watch/watch.py", line 165, in stream
    for line in iter_resp_lines(resp):
  File "/app/.venv/lib/python3.11/site-packages/kubernetes/watch/watch.py", line 56, in iter_resp_lines
    for seg in resp.stream(amt=None, decode_content=False):
  File "/app/.venv/lib/python3.11/site-packages/urllib3/response.py", line 624, in stream
    for line in self.read_chunked(amt, decode_content=decode_content):
  File "/app/.venv/lib/python3.11/site-packages/urllib3/response.py", line 816, in read_chunked
    with self._error_catcher():
  File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/app/.venv/lib/python3.11/site-packages/urllib3/response.py", line 449, in _error_catcher
    raise ReadTimeoutError(self._pool, None, "Read timed out.")
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='10.100.96.1', port=443): Read timed out.
{"time": "2024-04-06T20:34:43.094827+00:00", "msg": "No data/binaryData field in configmap", "level": "WARNING"}

Next to these logs, I'm not experiencing obvious issues with grafana, so I'm not sure what's up here

PauloFerreira25 commented 6 months ago

With me, there was a grafana dashboard config-map without the data content.

When I deleted the config-maps the problem was resolved.

PauloFerreira25 commented 6 months ago

https://github.com/grafana/helm-charts/blob/d6abf5108f12db44ddd376e2c0b058d0d1e3a482/charts/grafana/templates/dashboards-json-configmap.yaml#L32

This is what creates emptiness. I don't know what should be put in place so as not to have an empty data.