Skip to content
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

Promtail stops tailing statefulset pod on kubernetes after pod is deleted and rescheduled #3586

Closed
rsteneteg opened this issue Apr 7, 2021 · 0 comments · Fixed by #3587
Closed

Comments

@rsteneteg
Copy link
Contributor

Describe the bug
When deleting a statefulset pod on Kubernetes the pod and its logs gets deleted causing Promtail to stop the tailer, the pod is then rescheduled with a different path to the logfile since the pods uid changed, yet the pod name is the same causing Promtail to think it is the same target as before the restart. This prevents Promtail from creating a new target for the new logfile, since it already have a target with the same labels, but that target no longer have any tailer running, so no more logs is read from the pod

To Reproduce
Steps to reproduce the behavior:

  1. Deploy a statefulset
  2. Have Promtail v2.2.0 run on the same node as the statefulset pod
  3. Query the logs from the statefulset which at think point should work
  4. Delete the statefulset pod
  5. Query the logs from the statefulset which now would have stopped at the last line of the previous pod.

Expected behavior
Once Promtail has finished reading the last logs of the deleted pod, Promtail should pickup reading the logs from the new rescheduled pod

Environment:

  • Infrastructure: Kubernetes
  • Deployment tool: helm

Screenshots, Promtail config, or terminal output
Relabel config for the __path__

relabel_configs:
  - action: replace
    replacement: /var/log/pods/*$1/*.log
    separator: /
    source_labels:
    - __meta_kubernetes_pod_uid
    - __meta_kubernetes_pod_container_name
    target_label: __path__

in the /var/log/pods folder the path to the logs look like
/var/log/pods/<namespace>_<podname>_<uid>/<containername>/0.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant