cron-logging.yaml 902 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ---
  2. apiVersion: v1
  3. kind: Namespace
  4. metadata:
  5. name: logging
  6. # create dameonset to rsync pod logs
  7. ---
  8. apiVersion: apps/v1
  9. kind: DaemonSet
  10. metadata:
  11. name: cron-logging
  12. namespace: logging
  13. labels:
  14. k8s-app: cron-logging
  15. spec:
  16. selector:
  17. matchLabels:
  18. k8s-app: cron-logging
  19. template:
  20. metadata:
  21. labels:
  22. k8s-app: cron-logging
  23. spec:
  24. containers:
  25. - name: rsync
  26. image: "eeacms/rsync:latest"
  27. imagePullPolicy: IfNotPresent
  28. args:
  29. - /bin/sh
  30. - -c
  31. - >
  32. mkdir -p /var/log/history/;
  33. while true;
  34. do
  35. rsync -ax /var/log/pods/ /var/log/history/;
  36. sleep 1;
  37. done
  38. volumeMounts:
  39. - mountPath: /var/log
  40. name: varlog
  41. volumes:
  42. - hostPath:
  43. path: /var/log
  44. name: varlog