--- apiVersion: v1 kind: Namespace metadata: name: logging # create dameonset to rsync pod logs --- apiVersion: apps/v1 kind: DaemonSet metadata: name: cron-logging namespace: logging labels: k8s-app: cron-logging spec: selector: matchLabels: k8s-app: cron-logging template: metadata: labels: k8s-app: cron-logging spec: containers: - name: rsync image: "eeacms/rsync:latest" imagePullPolicy: IfNotPresent args: - /bin/sh - -c - > mkdir -p /var/log/history/; while true; do rsync -ax /var/log/pods/ /var/log/history/; sleep 1; done volumeMounts: - mountPath: /var/log name: varlog volumes: - hostPath: path: /var/log name: varlog