Address review suggestions and add Elasticsearch example

This commit is contained in:
Alejandro Moreno
2019-09-27 16:33:45 +00:00
parent ddf4a5e7c9
commit d87ca34cdd
14 changed files with 345 additions and 246 deletions
+95 -1
View File
@@ -46,7 +46,6 @@ The following tables lists the configurable parameters of the kibana chart and t
| ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `global.imageRegistry` | Global Docker image registry | `nil` |
| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
| `global.storageClass` | Global storage class for dynamic provisioning | `nil` |
| `image.registry` | Fluentd image registry | `docker.io` |
| `image.repository` | Fluentd image name | `bitnami/fluentd` |
| `image.tag` | Fluentd image tag | `{TAG_NAME}` |
@@ -135,6 +134,101 @@ $ helm install --name my-release -f values.yaml bitnami/fluentd
> **Tip**: You can use the default [values.yaml](values.yaml)
### Forwarding the logs to another service
By default, the aggregators in this chart will send the processed logs to the standard output. However, a common practice is to send them to another service, like Elasticsearch, instead. This can be achieved with this Helm Chart by mounting your own configuration files. For example:
**configmap.yaml**
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: elasticsearch-output
data:
fluentd.conf: |
# Prometheus Exporter Plugin
# input plugin that exports metrics
<source>
@type prometheus
port {{ .Values.metrics.service.port }}
</source>
# input plugin that collects metrics from MonitorAgent
<source>
@type prometheus_monitor
<labels>
host ${hostname}
</labels>
</source>
# input plugin that collects metrics for output plugin
<source>
@type prometheus_output_monitor
<labels>
host ${hostname}
</labels>
</source>
{{- end }}
# Ignore fluentd own events
<match fluent.**>
@type null
</match>
# TCP input to receive logs from the forwarders
<source>
@type forward
bind 0.0.0.0
port {{ .Values.aggregator.port }}
</source>
# HTTP input for the liveness and readiness probes
<source>
@type http
bind 0.0.0.0
port 9880
</source>
# Throw the healthcheck to the standard output instead of forwarding it
<match fluentd.healthcheck>
@type stdout
</match>
# Send the logs to the standard output
<match **>
@type elasticsearch
include_tag_key true
host "#{ENV['ELASTICSEARCH_HOST']}"
port "#{ENV['ELASTICSEARCH_PORT']}"
logstash_format true
<buffer>
@type file
path /opt/bitnami/fluentd/logs/buffers/logs.buffer
flush_thread_count 2
flush_interval 5s
</buffer>
</match>
```
Create the `ConfigMap` resource:
```console
$ kubectl create -f configmap.yaml
```
And then deploy the Fluentd chart with your configuration file and your Elasticsearch host and port:
```console
$ helm install bitnami/fluentd \
--set aggregator.configMap=elasticsearch-output \
--set aggregator.extraEnv[0].name=ELASTICSEARCH_HOST \
--set aggregator.extraEnv[0].value=your-ip-here \
--set aggregator.extraEnv[1].name=ELASTICSEARCH_PORT \
--set aggregator.extraEnv[1].value=your-port-here \
```
## [Rolling VS Immutable tags](https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/)
It is strongly recommended to use immutable tags in a production environment. This ensures your deployment does not change automatically if the same tag is updated with a different image.
+3 -2
View File
@@ -3,12 +3,13 @@
To verify that Fluentd has started, run:
kubectl get all -l "app.kubernetes.io/name={{ include "fluentd.name" . }},app.kubernetes.io/instance={{ .Release.Name }}"
{{ if not .Values.aggregator.configMap }}
Logs are captured on each node by the forwarder pods and then sent to the aggregator pods. By default, the aggregator pods send the logs to the standard output.
You can see all the logs by running this command:
kubectl logs -l "app.kubernetes.io/component=aggregator"
You can mount your own configuration files to the aggregators and the forwarders. For example, this is useful if you want to forward the aggregated logs to Elasticsearch or another service.
{{- end }}
{{ include "fluentd.checkRollingTags" . }}
{{- include "fluentd.checkRollingTags" . -}}
+57 -48
View File
@@ -61,12 +61,8 @@ Helm 2.11 supports the assignment of a value to a variable defined in a differen
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
Also, we can't use a single if because lazy evaluation is not an option
*/}}
{{- if .Values.global }}
{{- if .Values.global.imageRegistry }}
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- if .Values.global.imageRegistry }}
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
@@ -81,7 +77,6 @@ Helm 2.11 supports the assignment of a value to a variable defined in a differen
but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic.
Also, we can not use a single if because lazy evaluation is not an option
*/}}
{{- if .Values.global }}
{{- if .Values.global.imagePullSecrets }}
imagePullSecrets:
{{- range .Values.global.imagePullSecrets }}
@@ -93,47 +88,6 @@ imagePullSecrets:
- name: {{ . }}
{{- end }}
{{- end -}}
{{- else if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end -}}
{{- end -}}
{{/*
Return the proper Storage Class for the forwarders
*/}}
{{- define "fluentd.forwarder.storageClass" -}}
{{/*
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic.
*/}}
{{- if .Values.global -}}
{{- if .Values.global.storageClass -}}
{{- if (eq "-" .Values.global.storageClass) -}}
{{- printf "storageClassName: \"\"" -}}
{{- else }}
{{- printf "storageClassName: %s" .Values.global.storageClass -}}
{{- end -}}
{{- else -}}
{{- if .Values.forwarder.persistence.storageClass -}}
{{- if (eq "-" .Values.forwarder.persistence.storageClass) -}}
{{- printf "storageClassName: \"\"" -}}
{{- else }}
{{- printf "storageClassName: %s" .Values.forwarder.persistence.storageClass -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- if .Values.forwarder.persistence.storageClass -}}
{{- if (eq "-" .Values.forwarder.persistence.storageClass) -}}
{{- printf "storageClassName: \"\"" -}}
{{- else }}
{{- printf "storageClassName: %s" .Values.forwarder.persistence.storageClass -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
@@ -154,3 +108,58 @@ WARNING: Rolling tag detected ({{ .Values.image.repository }}:{{ .Values.image.t
+info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/
{{- end }}
{{- end -}}
{{/*
Validate data
*/}}
{{- define "fluentd.validateValues" -}}
{{- $messages := list -}}
{{- $messages := append $messages (include "fluentd.validateValues.rbac" .) -}}
{{- $messages := without $messages "" -}}
{{- $message := join "\n" $messages -}}
{{- if $message -}}
{{- printf "\nVALUES VALIDATION:\n%s" $message | fail -}}
{{- end -}}
{{- end -}}
{{/* Validate values of Fluentd - must create serviceAccount to create enable RBAC */}}
{{- define "fluentd.validateValues.rbac" -}}
{{- if and .Values.rbac.create (not .Values.serviceAccount.create) -}}
fluentd: rbac.create
A ServiceAccount is required ("rbac.create=true" is set)
Please create a ServiceAccount (--set serviceAccount.create=true)
{{- end -}}
{{- end -}}
{{/*
Get the forwarder configmap name.
*/}}
{{- define "fluentd.forwarder.configMap" -}}
{{- if .Values.forwarder.configMap -}}
{{- printf "%s" (tpl .Values.forwarder.configMap $) -}}
{{- else -}}
{{- printf "%s-forwarder-cm" (include "fluentd.fullname" . ) -}}
{{- end -}}
{{- end -}}
{{/*
Get the aggregator configmap name.
*/}}
{{- define "fluentd.aggregator.configMap" -}}
{{- if .Values.aggregator.configMap -}}
{{- printf "%s" (tpl .Values.aggregator.configMap $) -}}
{{- else -}}
{{- printf "%s-aggregator-cm" (include "fluentd.fullname" . ) -}}
{{- end -}}
{{- end -}}
{{/*
Get the certificates secret name.
*/}}
{{- define "fluentd.tls.secretName" -}}
{{- if .Values.tls.existingSecret -}}
{{- printf "%s" (tpl .Values.tls.existingSecret $) -}}
{{- else -}}
{{- printf "%s-certs" (include "fluentd.fullname" . ) -}}
{{- end -}}
{{- end -}}
@@ -3,11 +3,11 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "fluentd.fullname" . }}-aggregator-cm
labels: {{ include "fluentd.labels" . | nindent 4 }}
labels: {{- include "fluentd.labels" . | nindent 4 }}
app.kubernetes.io/component: aggregator
data:
fluentd.conf: |
{{- if .Values.metrics.enabled }}
{{- if .Values.metrics.enabled -}}
# Prometheus Exporter Plugin
# input plugin that exports metrics
<source>
@@ -31,7 +31,7 @@ data:
</labels>
</source>
{{- end }}
# Ignore fluentd own events
<match fluent.**>
@type null
@@ -2,18 +2,18 @@ apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "fluentd.fullname" . }}
labels: {{ include "fluentd.labels" . | nindent 4 }}
labels: {{- include "fluentd.labels" . | nindent 4 }}
app.kubernetes.io/component: aggregator
spec:
selector:
matchLabels: {{ include "fluentd.matchLabels" . | nindent 6 }}
matchLabels: {{- include "fluentd.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: aggregator
serviceName: {{ include "fluentd.fullname" . }}-headless
replicas: {{ .Values.aggregator.replicaCount }}
updateStrategy: {{ toYaml .Values.aggregator.updateStrategy | nindent 4 }}
updateStrategy: {{- toYaml .Values.aggregator.updateStrategy | nindent 4 }}
template:
metadata:
labels: {{ include "fluentd.labels" . | nindent 8 }}
labels: {{- include "fluentd.labels" . | nindent 8 }}
app.kubernetes.io/component: aggregator
annotations:
checksum/config: {{ include (print $.Template.BasePath "/aggregator-configmap.yaml") . | sha256sum }}
@@ -26,91 +26,87 @@ spec:
securityContext:
runAsUser: {{ .Values.securityContext.runAsUser }}
fsGroup: {{ .Values.securityContext.fsGroup }}
runAsNonRoot: {{ .Values.securityContext.runAsNonRoot }}
{{- end }}
containers:
- name: fluentd
image: {{ include "fluentd.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: FLUENTD_CONF
value: {{ .Values.aggregator.configFile }}
- name: FLUENTD_OPT
value: {{ .Values.aggregator.extraArgs }}
{{- if .Values.aggregator.extraEnv }}
{{- toYaml .Values.aggregator.extraEnv | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 9880
protocol: TCP
- name: tcp
containerPort: {{ .Values.aggregator.port }}
protocol: TCP
{{- if .Values.metrics.enabled }}
- name: metrics
containerPort: {{ .Values.metrics.service.port }}
protocol: TCP
{{- end }}
{{- if .Values.aggregator.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /fluentd.healthcheck?json=%7B%22ping%22%3A+%22pong%22%7D
port: http
initialDelaySeconds: {{ .Values.aggregator.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.aggregator.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.aggregator.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.aggregator.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.aggregator.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.aggregator.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /fluentd.healthcheck?json=%7B%22ping%22%3A+%22pong%22%7D
port: http
initialDelaySeconds: {{ .Values.aggregator.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.aggregator.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.aggregator.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.aggregator.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.aggregator.readinessProbe.failureThreshold }}
{{- end }}
resources: {{ toYaml .Values.aggregator.resources | nindent 12 }}
volumeMounts:
- name: fluentd-config
mountPath: /opt/bitnami/fluentd/conf
- name: buffer
mountPath: /opt/bitnami/fluentd/logs/buffers
{{- if .Values.tls.enabled }}
- name: {{ template "fluentd.fullname" . }}-certs
mountPath: /opt/bitnami/fluentd/certs
{{- end }}
volumes:
- name: fluentd
image: {{ include "fluentd.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: FLUENTD_CONF
value: {{ .Values.aggregator.configFile }}
- name: FLUENTD_OPT
value: {{ .Values.aggregator.extraArgs | quote }}
{{- if .Values.aggregator.extraEnv }}
{{- toYaml .Values.aggregator.extraEnv | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 9880
protocol: TCP
- name: tcp
containerPort: {{ .Values.aggregator.port }}
protocol: TCP
{{- if .Values.metrics.enabled }}
- name: metrics
containerPort: {{ .Values.metrics.service.port }}
protocol: TCP
{{- end }}
{{- if .Values.aggregator.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /fluentd.healthcheck?json=%7B%22ping%22%3A+%22pong%22%7D
port: http
initialDelaySeconds: {{ .Values.aggregator.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.aggregator.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.aggregator.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.aggregator.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.aggregator.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.aggregator.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /fluentd.healthcheck?json=%7B%22ping%22%3A+%22pong%22%7D
port: http
initialDelaySeconds: {{ .Values.aggregator.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.aggregator.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.aggregator.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.aggregator.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.aggregator.readinessProbe.failureThreshold }}
{{- end }}
resources: {{- toYaml .Values.aggregator.resources | nindent 10 }}
volumeMounts:
- name: fluentd-config
mountPath: /opt/bitnami/fluentd/conf
- name: buffer
mountPath: /opt/bitnami/fluentd/logs/buffers
{{- if .Values.tls.enabled }}
- name: {{ template "fluentd.fullname" . }}-certs
secret:
secretName: {{ if .Values.tls.existingSecret }}{{ .Values.tls.existingSecret }}{{- else }}{{ template "fluentd.fullname" . }}-certs{{- end }}
items:
- key: ca_certificate.pem
path: ca_certificate.pem
- key: server_certificate.pem
path: server_certificate.pem
- key: server_key.pem
path: server_key.pem
mountPath: /opt/bitnami/fluentd/certs
{{- end }}
- name: fluentd-config
configMap:
name: {{ if .Values.aggregator.configMap }}{{ .Values.aggregator.configMap }}{{- else }}{{ include "fluentd.fullname" . }}-aggregator-cm{{- end }}
- name: buffer
emptyDir: {}
volumes:
{{- if .Values.tls.enabled }}
- name: {{ template "fluentd.fullname" . }}-certs
secret:
secretName: {{ template "fluentd.tls.secretName" . }}
items:
- key: ca_certificate.pem
path: ca_certificate.pem
- key: server_certificate.pem
path: server_certificate.pem
- key: server_key.pem
path: server_key.pem
{{- end }}
- name: fluentd-config
configMap:
name: {{ template "fluentd.aggregator.configMap" . }}
- name: buffer
emptyDir: {}
{{- with .Values.aggregator.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.aggregator.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
affinity: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.aggregator.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
tolerations: {{- toYaml . | nindent 8 }}
{{- end }}
+1 -1
View File
@@ -3,7 +3,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ include "fluentd.fullname" . }}-certs
labels: {{ include "fluentd.labels" . | nindent 4 }}
labels: {{- include "fluentd.labels" . | nindent 4 }}
type: Opaque
data:
ca_certificate.pem:
+1 -1
View File
@@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "fluentd.fullname" . }}
labels: {{ include "fluentd.labels" . | nindent 4 }}
labels: {{- include "fluentd.labels" . | nindent 4 }}
rules:
- apiGroups:
- ""
@@ -3,7 +3,7 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "fluentd.fullname" . }}
labels: {{ include "fluentd.labels" . | nindent 4 }}
labels: {{- include "fluentd.labels" . | nindent 4 }}
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
@@ -3,11 +3,11 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "fluentd.fullname" . }}-forwarder-cm
labels: {{ include "fluentd.labels" . | nindent 4 }}
labels: {{- include "fluentd.labels" . | nindent 4 }}
app.kubernetes.io/component: forwarder
data:
fluentd.conf: |
{{- if .Values.metrics.enabled }}
{{- if .Values.metrics.enabled -}}
# Prometheus Exporter Plugin
# input plugin that exports metrics
<source>
@@ -61,7 +61,7 @@ data:
@type tail
path /var/log/containers/*.log
# exclude Fluentd logs
exclude_path /var/log/containers/{{ include "fluentd.fullname" . }}*.log
exclude_path /var/log/containers/*fluentd*.log
pos_file /opt/bitnami/fluentd/logs/buffers/fluentd-docker.pos
tag kubernetes.*
read_from_head true
@@ -71,7 +71,8 @@ data:
time_format %Y-%m-%dT%H:%M:%S.%NZ
</parse>
</source>
# enrich with kubernetes metadata
<filter kubernetes.**>
@type kubernetes_metadata
</filter>
@@ -94,7 +95,10 @@ data:
{{- end}}
<buffer>
flush_interval 10s
@type file
path /opt/bitnami/fluentd/logs/buffers/logs.buffer
flush_thread_count 2
flush_interval 5s
</buffer>
</match>
{{- end -}}
@@ -2,16 +2,16 @@ apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ include "fluentd.fullname" . }}
labels: {{ include "fluentd.labels" . | nindent 4 }}
labels: {{- include "fluentd.labels" . | nindent 4 }}
app.kubernetes.io/component: forwarder
spec:
selector:
matchLabels: {{ include "fluentd.matchLabels" . | nindent 6 }}
matchLabels: {{- include "fluentd.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: forwarder
updateStrategy: {{ toYaml .Values.forwarder.updateStrategy | nindent 4 }}
updateStrategy: {{- toYaml .Values.forwarder.updateStrategy | nindent 4 }}
template:
metadata:
labels: {{ include "fluentd.labels" . | nindent 8 }}
labels: {{- include "fluentd.labels" . | nindent 8 }}
app.kubernetes.io/component: forwarder
annotations:
checksum/config: {{ include (print $.Template.BasePath "/forwarder-configmap.yaml") . | sha256sum }}
@@ -25,98 +25,94 @@ spec:
securityContext:
runAsUser: {{ .Values.securityContext.runAsUser }}
fsGroup: {{ .Values.securityContext.fsGroup }}
runAsNonRoot: {{ .Values.securityContext.runAsNonRoot }}
{{- end }}
containers:
- name: fluentd
image: {{ include "fluentd.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: FLUENTD_CONF
value: {{ .Values.forwarder.configFile }}
- name: FLUENTD_OPT
value: {{ .Values.forwarder.extraArgs }}
{{- if .Values.forwarder.extraEnv }}
{{- toYaml .Values.forwarder.extraEnv | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 9880
protocol: TCP
{{- if .Values.metrics.enabled }}
- name: metrics
containerPort: {{ .Values.metrics.service.port }}
protocol: TCP
{{- end }}
{{- if .Values.forwarder.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /fluentd.healthcheck?json=%7B%22ping%22%3A+%22pong%22%7D
port: http
initialDelaySeconds: {{ .Values.forwarder.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.forwarder.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.forwarder.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.forwarder.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.forwarder.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.forwarder.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /fluentd.healthcheck?json=%7B%22ping%22%3A+%22pong%22%7D
port: http
initialDelaySeconds: {{ .Values.forwarder.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.forwarder.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.forwarder.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.forwarder.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.forwarder.readinessProbe.failureThreshold }}
{{- end }}
resources: {{ toYaml .Values.forwarder.resources | nindent 12 }}
volumeMounts:
- name: fluentd-config
mountPath: /opt/bitnami/fluentd/conf
- name: buffer
mountPath: /opt/bitnami/fluentd/logs/buffers
{{- if .Values.tls.enabled }}
- name: {{ template "fluentd.fullname" . }}-certs
mountPath: /opt/bitnami/fluentd/certs
{{- end }}
- name: varlog
mountPath: /var/log
- name: varlibdockercontainers
mountPath: /var/lib/docker/containers
volumes:
- name: fluentd
image: {{ include "fluentd.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: FLUENTD_CONF
value: {{ .Values.forwarder.configFile }}
- name: FLUENTD_OPT
value: {{ .Values.forwarder.extraArgs | quote }}
{{- if .Values.forwarder.extraEnv }}
{{- toYaml .Values.forwarder.extraEnv | nindent 8 }}
{{- end }}
ports:
- name: http
containerPort: 9880
protocol: TCP
{{- if .Values.metrics.enabled }}
- name: metrics
containerPort: {{ .Values.metrics.service.port }}
protocol: TCP
{{- end }}
{{- if .Values.forwarder.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /fluentd.healthcheck?json=%7B%22ping%22%3A+%22pong%22%7D
port: http
initialDelaySeconds: {{ .Values.forwarder.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.forwarder.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.forwarder.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.forwarder.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.forwarder.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.forwarder.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /fluentd.healthcheck?json=%7B%22ping%22%3A+%22pong%22%7D
port: http
initialDelaySeconds: {{ .Values.forwarder.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.forwarder.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.forwarder.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.forwarder.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.forwarder.readinessProbe.failureThreshold }}
{{- end }}
resources: {{- toYaml .Values.forwarder.resources | nindent 10 }}
volumeMounts:
- name: fluentd-config
mountPath: /opt/bitnami/fluentd/conf
- name: buffer
mountPath: /opt/bitnami/fluentd/logs/buffers
{{- if .Values.tls.enabled }}
- name: {{ template "fluentd.fullname" . }}-certs
secret:
secretName: {{ if .Values.tls.existingSecret }}{{ .Values.tls.existingSecret }}{{- else }}{{ template "fluentd.fullname" . }}-certs{{- end }}
items:
- key: ca_certificate.pem
path: ca_certificate.pem
- key: server_certificate.pem
path: server_certificate.pem
- key: server_key.pem
path: server_key.pem
mountPath: /opt/bitnami/fluentd/certs
{{- end }}
- name: fluentd-config
configMap:
name: {{ if .Values.forwarder.configMap }}{{ .Values.forwarder.configMap }}{{- else }}{{ include "fluentd.fullname" . }}-forwarder-cm{{- end }}
- name: buffer
emptyDir: {}
- name: varlog
hostPath:
path: /var/log
mountPath: /var/log
- name: varlibdockercontainers
hostPath:
path: /var/lib/docker/containers
mountPath: /var/lib/docker/containers
volumes:
{{- if .Values.tls.enabled }}
- name: {{ template "fluentd.fullname" . }}-certs
secret:
secretName: {{ template "fluentd.tls.secretName" . }}
items:
- key: ca_certificate.pem
path: ca_certificate.pem
- key: server_certificate.pem
path: server_certificate.pem
- key: server_key.pem
path: server_key.pem
{{- end }}
- name: fluentd-config
configMap:
name: {{ template "fluentd.forwarder.configMap" . }}
- name: buffer
emptyDir: {}
- name: varlog
hostPath:
path: /var/log
- name: varlibdockercontainers
hostPath:
path: /var/lib/docker/containers
{{- with .Values.forwarder.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.forwarder.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
affinity: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.forwarder.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
tolerations: {{- toYaml . | nindent 8 }}
{{- end }}
@@ -3,5 +3,5 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "fluentd.serviceAccountName" . }}
labels: {{ include "fluentd.labels" . | nindent 4 }}
labels: {{- include "fluentd.labels" . | nindent 4 }}
{{- end -}}
+5 -5
View File
@@ -2,14 +2,14 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "fluentd.fullname" . }}-headless
labels: {{ include "fluentd.labels" . | nindent 4 }}
labels: {{- include "fluentd.labels" . | nindent 4 }}
app.kubernetes.io/component: aggregator
spec:
type: ClusterIP
clusterIP: None
ports:
- name: tcp
port: {{ .Values.aggregator.port }}
targetPort: tcp
selector: {{ include "fluentd.matchLabels" . | nindent 4 }}
- name: tcp
port: {{ .Values.aggregator.port }}
targetPort: tcp
selector: {{- include "fluentd.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: aggregator
+3 -3
View File
@@ -3,8 +3,8 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "fluentd.fullname" . }}
labels: {{ include "fluentd.labels" . | nindent 4 }}
annotations: {{ tpl (toYaml .Values.metrics.service.annotations) $ | nindent 4 }}
labels: {{- include "fluentd.labels" . | nindent 4 }}
annotations: {{- tpl (toYaml .Values.metrics.service.annotations) $ | nindent 4 }}
spec:
type: {{ .Values.metrics.service.type }}
{{- if and (eq .Values.metrics.service.type "LoadBalancer") .Values.metrics.service.loadBalancerIP }}
@@ -14,5 +14,5 @@ spec:
- name: metrics
port: {{ .Values.metrics.service.port }}
targetPort: metrics
selector: {{ include "fluentd.matchLabels" . | nindent 4 }}
selector: {{- include "fluentd.matchLabels" . | nindent 4 }}
{{- end }}
+7 -8
View File
@@ -1,12 +1,11 @@
## Global Docker image parameters
## Please, note that this will override the image parameters, including dependencies, configured to use the global value
## Current available global Docker image parameters: imageRegistry, imagePullSecrets and storageClass
## Current available global Docker image parameters: imageRegistry and imagePullSecrets
##
# global:
global: {}
# imageRegistry: myRegistryName
# imagePullSecrets:
# - myRegistryKeySecretName
# storageClass: myStorageClass
## Bitnami Fluentd image version
## ref: https://hub.docker.com/r/bitnami/fluentd/tags/
@@ -56,7 +55,7 @@ forwarder:
## Extra environment variables to pass to the container
## extraEnv:
## - name: MY_ENV_VAR
## - value: my_value
## value: my_value
##
extraEnv: {}
@@ -78,7 +77,7 @@ forwarder:
failureThreshold: 6
successThreshold: 1
## Set up update strategy.
## Set up update strategy.
## ref: https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/#daemonset-update-strategy
## Example:
# updateStrategy:
@@ -216,7 +215,7 @@ serviceAccount:
##
create: true
## The name of the ServiceAccount to use.
## If not set and create is true, a name is generated using the mariadb-galera.fullname template
## If not set and create is true, a name is generated using the fluentd.fullname template
# name:
## Role Based Access
@@ -225,14 +224,14 @@ serviceAccount:
rbac:
create: true
## Prometheus metrics
## Prometheus metrics
## ref: https://github.com/fluent/fluent-plugin-prometheus/blob/master/README.md
##
metrics:
enabled: false
service:
type: ClusterIP
# loadBalancerIP:
# loadBalancerIP:
port: 24231
## Annotations for the Prometheus metrics service
##