logexporter-daemonset.yaml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # Template job config for running the log exporter on the cluster as a daemonset.
  2. # Creates everything within 'logexporter' namespace.
  3. #
  4. # Note: Since daemonsets have "AlwaysRestart" policy for pods, we provide a long
  5. # sleep-duration (24 hr) to the logexporter pods so they don't finish the work and
  6. # get restarted while some pods are still running. So it is your duty to detect
  7. # the work has been done (or use some timeout) and delete the daemonset yourself.
  8. apiVersion: v1
  9. kind: Namespace
  10. metadata:
  11. name: {{.LogexporterNamespace}}
  12. ---
  13. apiVersion: v1
  14. kind: Secret
  15. metadata:
  16. name: google-service-account
  17. namespace: {{.LogexporterNamespace}}
  18. type: Opaque
  19. data:
  20. service-account.json: {{.ServiceAccountCredentials}}
  21. ---
  22. apiVersion: apps/v1
  23. kind: DaemonSet
  24. metadata:
  25. name: logexporter
  26. namespace: {{.LogexporterNamespace}}
  27. spec:
  28. selector:
  29. matchLabels:
  30. app: logexporter
  31. template:
  32. metadata:
  33. labels:
  34. app: logexporter
  35. spec:
  36. containers:
  37. - name: logexporter-test
  38. image: gcr.io/k8s-testimages/logexporter:v20190729-6ada3329e
  39. env:
  40. - name: NODE_NAME
  41. valueFrom:
  42. fieldRef:
  43. fieldPath: spec.nodeName
  44. command:
  45. - logexporter
  46. - --node-name=$(NODE_NAME)
  47. - --cloud-provider={{.CloudProvider}}
  48. - --gcs-path={{.GCSPath}}
  49. - --gcloud-auth-file-path=/etc/service-account/service-account.json
  50. - --enable-hollow-node-logs={{.EnableHollowNodeLogs}}
  51. - --dump-systemd-journal={{.DumpSystemdJournal}}
  52. - --sleep-duration=24h
  53. - --alsologtostderr
  54. volumeMounts:
  55. - mountPath: /etc/service-account
  56. name: service
  57. readOnly: true
  58. - mountPath: /var/log
  59. name: varlog
  60. readOnly: true
  61. - mountPath: /workspace/etc
  62. name: hostetc
  63. readOnly: true
  64. resources:
  65. requests:
  66. cpu: 10m
  67. memory: 10Mi
  68. volumes:
  69. - name: service
  70. secret:
  71. secretName: google-service-account
  72. - name: varlog
  73. hostPath:
  74. path: /var/log
  75. - name: hostetc
  76. hostPath:
  77. path: /etc