Kubernetes only keeps logs for the current instance and the previous
instance of a running pod. At this time, a kubectl configuration to
customize this behavior has not been found.
To prevent losing flux logs everytime flux is restarted, the command
and arguments passed to the containers have been adapted to forward
stdout and stderr to a log file in a volume hosted at /var/log/flux
The container commands are the adapted from the Entrypoints in their
Dockerfiles [1] and [2]. Note helm-controller uses tini to create
its process while source-controller doesn't.
Test Plan:
pass: Run bootstrap. Confirm logs are being saved to /var/log/flux
pass: Run unlock to restart the node. New flux logs still saved to
same files, despite kubectl rotating log files at /var/log/pods
pass: Restart node. New flux logs preserve old entries, despite kubectl
erasing old log files at /var/log/pods
pass: Restart flux. flux log files preserved and logging still normal
pass: logrotate rotating /var/log/flux logs
Reviewed: https:/ /review. opendev. org/c/starlingx /ansible- playbooks/ +/876895 /opendev. org/starlingx/ ansible- playbooks/ commit/ 23561c8fe31ba3c b99612f418c9cbc 2da2a7ca7f
Committed: https:/
Submitter: "Zuul (22348)"
Branch: master
commit 23561c8fe31ba3c b99612f418c9cbc 2da2a7ca7f
Author: Leonardo Fagundes Luz Serrano <email address hidden>
Date: Wed Mar 8 18:18:19 2023 -0300
Backup flux pod logs
Kubernetes only keeps logs for the current instance and the previous
instance of a running pod. At this time, a kubectl configuration to
customize this behavior has not been found.
To prevent losing flux logs everytime flux is restarted, the command
and arguments passed to the containers have been adapted to forward
stdout and stderr to a log file in a volume hosted at /var/log/flux
The container commands are the adapted from the Entrypoints in their
Dockerfiles [1] and [2]. Note helm-controller uses tini to create
its process while source-controller doesn't.
[1] https:/ /github. com/fluxcd/ source- controller/ blob/v0. 32.1/Dockerfile /github. com/fluxcd/ helm-controller /blob/v0. 27.0/Dockerfile
[2] https:/
Test Plan:
pass: Run bootstrap. Confirm logs are being saved to /var/log/flux
pass: Run unlock to restart the node. New flux logs still saved to
same files, despite kubectl rotating log files at /var/log/pods
pass: Restart node. New flux logs preserve old entries, despite kubectl
erasing old log files at /var/log/pods
pass: Restart flux. flux log files preserved and logging still normal
pass: logrotate rotating /var/log/flux logs
Depends-On: https:/ /review. opendev. org/c/starlingx /config- files/+ /877669
Closes-Bug: 2009784
Signed-off-by: Leonardo Fagundes Luz Serrano <email address hidden> 12cb45706c9f49b 2b43a888877
Change-Id: I2863e7e76a4324