deployment.yaml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. apiVersion: apps/v1beta2
  2. kind: Deployment
  3. metadata:
  4. name: {{ template "elasticsearch-exporter.fullname" . }}
  5. labels:
  6. chart: {{ template "elasticsearch-exporter.chart" . }}
  7. k8s-app: {{ template "elasticsearch-exporter.name" . }}
  8. release: "{{ .Release.Name }}"
  9. heritage: "{{ .Release.Service }}"
  10. spec:
  11. replicas: {{ .Values.replicaCount }}
  12. selector:
  13. matchLabels:
  14. k8s-app: {{ template "elasticsearch-exporter.name" . }}
  15. release: "{{ .Release.Name }}"
  16. strategy:
  17. rollingUpdate:
  18. maxSurge: 1
  19. maxUnavailable: 0
  20. type: RollingUpdate
  21. template:
  22. metadata:
  23. labels:
  24. k8s-app: {{ template "elasticsearch-exporter.name" . }}
  25. release: "{{ .Release.Name }}"
  26. {{- if .Values.podAnnotations }}
  27. annotations:
  28. {{ toYaml .Values.podAnnotations | indent 8 }}
  29. {{- end }}
  30. spec:
  31. {{- if .Values.priorityClassName }}
  32. priorityClassName: "{{ .Values.priorityClassName }}"
  33. {{- end }}
  34. restartPolicy: {{ .Values.restartPolicy }}
  35. securityContext:
  36. runAsNonRoot: true
  37. runAsUser: 1000
  38. containers:
  39. - name: {{ .Chart.Name }}
  40. image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
  41. imagePullPolicy: {{ .Values.image.pullPolicy }}
  42. command: ["elasticsearch_exporter",
  43. "-es.uri={{ .Values.es.uri }}",
  44. "-es.all={{ .Values.es.all }}",
  45. "-es.indices={{ .Values.es.indices }}",
  46. "-es.timeout={{ .Values.es.timeout }}",
  47. {{- if .Values.es.ssl.enabled }}
  48. "-es.ca=/ssl/ca.pem",
  49. "-es.client-cert=/ssl/client.pem",
  50. "-es.client-private-key=/ssl/client.key",
  51. {{- end }}
  52. "-web.listen-address=:{{ .Values.service.httpPort }}",
  53. "-web.telemetry-path={{ .Values.web.path }}"]
  54. securityContext:
  55. capabilities:
  56. drop:
  57. - SETPCAP
  58. - MKNOD
  59. - AUDIT_WRITE
  60. - CHOWN
  61. - NET_RAW
  62. - DAC_OVERRIDE
  63. - FOWNER
  64. - FSETID
  65. - KILL
  66. - SETGID
  67. - SETUID
  68. - NET_BIND_SERVICE
  69. - SYS_CHROOT
  70. - SETFCAP
  71. readOnlyRootFilesystem: true
  72. resources:
  73. {{ toYaml .Values.resources | indent 12 }}
  74. ports:
  75. - containerPort: {{ .Values.service.httpPort }}
  76. name: http
  77. livenessProbe:
  78. httpGet:
  79. path: /health
  80. port: http
  81. initialDelaySeconds: 30
  82. timeoutSeconds: 10
  83. readinessProbe:
  84. httpGet:
  85. path: /health
  86. port: http
  87. initialDelaySeconds: 10
  88. timeoutSeconds: 10
  89. volumeMounts:
  90. {{- if .Values.es.ssl.enabled }}
  91. - mountPath: /ssl
  92. name: ssl
  93. {{- end }}
  94. {{- if .Values.nodeSelector }}
  95. nodeSelector:
  96. {{ toYaml .Values.nodeSelector | indent 8 }}
  97. {{- end }}
  98. {{- if .Values.tolerations }}
  99. tolerations:
  100. {{ toYaml .Values.tolerations | indent 8 }}
  101. {{- end }}
  102. volumes:
  103. {{- if .Values.es.ssl.enabled }}
  104. - name: ssl
  105. secret:
  106. secretName: {{ template "elasticsearch-exporter.fullname" . }}-cert
  107. {{- end }}