-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dashboard sidecar stops working after 10 minutes #18
Comments
+1 I have the exact same issue, and after a couple of minutes sidecar stops receiving notifications on configmap changes. Also sidecar doesn't detect and import new dashboards via configmaps. All changes to the dashboards and new dashboards appear after restarting the grafana pod or sidecar container. |
Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
Same issue. |
using https://github.com/OmegaVVeapon/kopf-k8s-sidecar instead of kiwigrid/k8s-sidecar may address the issue, here is a comment from @djsly indicating success with that one: kiwigrid/k8s-sidecar#85 (comment) |
Any updates on this? |
I tried using OmegaVVeapon/kopf-k8s-sidecar as a replacement for kiwigrid/k8s-sidecar but just hit this issue: OmegaVVeapon/kopf-k8s-sidecar#14 |
As the OmegaVVeapon/kopf-k8s-sidecar#14 turned out to be a dead end to use it along with this chart, i came up with this very ugly workaround which i'm not proud of, but in 2 hours this is what ai was able to do, we need to craft a PR to address the underlying issue in kiwigrid/k8s-sidecar#85 Here is the values file snippet i used: rbac:
# The extra rules below are required to run the `kubectl exec ...`
# command in the force-grafana-dashboard-reload container below.
extraRoleRules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get"]
- apiGroups: [""]
resources: ["pods/exec"]
verbs: ["create"]
# This is a workaround for an upstream bug,
# this will force grafana dashboards to be reloaded every 15 minutes.
# Its 15 minutes because the grafana-sc-dashboard pod will regularly be in
# CrashLoopBackOff if we dont allow it to run at least 10 minutes,
# CrashLoopBackOff timer is reset after 10 minutes without any problems.
# See these issues for details:
# https://github.com/kiwigrid/k8s-sidecar/issues/85
# https://github.com/grafana/helm-charts/issues/18
extraContainers: |
- name: force-grafana-dashboard-reload
image: bitnami/kubectl:1.19
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
command: ["bash", "-c"]
args:
- while sleep 900; do
echo Forcing grafana sidecar to restart ...;
kubectl exec -n $POD_NAMESPACE $POD_NAME -c grafana-sc-dashboard -- kill 1;
done |
The original issue on k8s-sidecar has been open for 176 days at the time of writing so I think an update on the situation is warranted. Having the process hang constantly hang is what prompted me to do an entire rewrite in kopf-k8s-sidecar and what made @bergerx spawn a container with I've been giving this some thought and these are the possible solutions I see for this problem atm, from best to worst: 1. Fix the original kiwigrid/k8s-sidecarI'm not hopeful this is going to happen... 2. Add the functionality to kopf-k8s-sidecar to run once only (issue)I've inquired about how to accomplish such a behaviour in this question and it looks like it won't be trivial... I could give it a try regardless. 3. Avoid initContainers!This is the solution I'm currently using since it can be readily used with minimal tweaking. After inspecting this Helm chart I discovered that it uses the k8s-sidecar as an If they are, the sidecar is started as an So, given that this is a one-off operation, I decided to simply disable and use kopf-k8s-sidecar for the image I currently have a fully-functional Grafana from which I'm able to add/modify/delete dashboards without issues via configmaps/secrets. The only downside I see here is if for whatever reason you can't provide your datasources/notifiers via the 4. Allow users to use different sidecar images depending on the use caseSo, if you've followed so far, the tl;dr is that the original sidecar isn't very good at staying alive. My sidecar isn't very good at dying. So why not let each sidecar do what they do best? Rather than using the same I could submit a small PR for this if deemed useful. Anyways, those are my current thoughts on the state of things. Feedback is welcome. |
Solution 3 seems reasonable to me but i dont get this part:
This exact design has already been a problem for us, as in some clusters we want to be able to define datasources on the go as we create new configmaps/secrets. Current design is preventing that, this design also kind of conflicts with the idea of declaring datasources as configmaps. |
Yeah... I found this to be odd as well. Maybe one of the Grafana maintainers can elaborate a bit more on that. That being said, I think I know how we can add new datasources on-the-fly but I'll have to test it tomorrow. |
@bergerx I have good and bad news. So I tested loading up datasources dynamically (as part of the normal long-running sidecar, not the init one) and it worked... sorta.
That However... once you reach the "HTTP Server Listen" listen part, Grafana no longer cares about what YAMLs the sidecar throws into So it's a no go unless the Grafana devs add the same reloading logic for datasources as they do for dashboards I'm afraid... This also sucks because, if it picked up datasources at any point in time, then we could ABSOLUTELY get rid of both sidecar initContainers (who cares if the files get loaded before or after Grafana starts?). That would vastly decrease the complexity of the chart and the In my case, the datasource loading worked even without initContainers but I can't guarantee my sidecar (or kiwigrid's) will always beat Grafana in initializing, you'd be rolling the dice. So the only real choice remains to: Either way, you won't get "on the go" updates. |
FYI, sidecar upgrade merged. |
@qaiserali |
I looked at all diff between 1.1.0 and 1.10.0 and the only related fix would be https://github.com/kiwigrid/k8s-sidecar/releases/tag/1.3.0
doesn't look too promising |
Are there any updates on this issue? |
@OmegaVVeapon |
Not sure, will need to sleep on it. My image is basically a rewrite of the k8s-sidecar so the PR would be quite massive. I'd need confirmation from the original maintainers of the k8s-sidecar that this is something they would even be interested in accepting before trying to change their entire codebase. Perhaps a better starting point would be for people struggling with this issue to switch to my image and see if it resolves it for them? I documented the very simple instructions to use it with this helm chart here If it's helping enough people then I'd say PR'ing it back to k8s-sidecar is a much easier sell. Otherwise, I'll just leave it as an alternative. |
@OmegaVVeapon I think he was asking to PR it into the helm-chart repo. Maybe we could add a toggle to switch between the original sidecar and yours. |
Ah, I see. If that's the case, I think I'll still leave it as an opt-in via the values.yaml for now. There's a few more things I want to add before PR'ing it as a default. |
Issue is reproducible with 1.14.2 sidecar as well.
|
Reading the comments on two issues linked above leaves me unsure about current status of this. Is it fixed in kiwigrid v1.15.4? Is there a PR coming for the chart to allow setting |
The issue seems to persist with the 1.19.2 Sidecar. Upgrading to 1.20 made the issue disappear. |
Fixes grafana#18 Signed-off-by: Bernd May <b.may@syseleven.de>
Describe the bug
kiwigrid/k8s-sidecar#85
After 10 minutes the dashboard sidecar stops receiving watch notifications
Originally posted on old repo: helm/charts#23565
Version of Helm and Kubernetes:
Helm version N/A
Kubernetes 1.16.10
Which chart:
stable/grafana
What happened:
After 10 minutes the dashboard sidecar stops receiving watch notifications
What you expected to happen:
The sidecar to always pick up new dashboards
How to reproduce it (as minimally and precisely as possible):
See kiwigrid/k8s-sidecar#85
The text was updated successfully, but these errors were encountered: