Skip to content
Snippets Groups Projects
Verified Commit f46dc430 authored by Sheogorath's avatar Sheogorath :european_castle:
Browse files

fix(system-upgrade): Prevent logs from spoiling a node

This patch installs a log rotate function that prevents the
/var/log/messages log to become gigabytes in size and rotating them away
with a maximum size of 100M.

The reason for this is to prevent the host system from getting issues
due to excessive logging and rendering a host unusable.
parent 4d22ce09
No related branches found
No related tags found
No related merge requests found
......@@ -8,4 +8,5 @@ resources:
- kubelet.yaml
- longhorn-lvm.yaml
- longhorn-setup.yaml
- logrotate.yaml
- fedora-temperature-management.yaml
---
apiVersion: v1
kind: Secret
metadata:
name: logrotate-setup
namespace: system-upgrade
type: Opaque
stringData:
logrotate.conf: |
/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
{
maxsize 250M
missingok
sharedscripts
postrotate
/usr/bin/systemctl kill -s HUP rsyslog.service >/dev/null 2>&1 || true
endscript
}
upgrade.sh: |
#!/bin/sh
set -e
set -x
secrets="$(dirname $0)"
cp $secrets/logrotate.conf /etc/logrotate.d/rsyslog
rm /etc/logrotate.d/kubernetes-survival
---
apiVersion: upgrade.cattle.io/v1
kind: Plan
metadata:
name: logrotate-setup
namespace: system-upgrade
spec:
concurrency: 1
nodeSelector:
matchExpressions:
- key: feature.node.kubernetes.io/system-os_release.ID
operator: In
values:
- "fedora"
- key: feature.node.kubernetes.io/system-os_release.VERSION_ID.major
operator: In
values:
- "35"
serviceAccountName: system-upgrade
secrets:
- name: logrotate-setup
path: /host/run/system-upgrade/secrets/logrotate-setup
version: "1.0.0"
upgrade:
image: docker.io/library/fedora:35
command: ["chroot", "/host"]
args: ["sh", "/run/system-upgrade/secrets/logrotate-setup/upgrade.sh"]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment