From 96e2640cb6f3a1e261c7af165ac68403dccbba2a Mon Sep 17 00:00:00 2001 From: Alejandro Moreno Date: Thu, 19 Sep 2019 15:20:08 +0000 Subject: [PATCH 01/10] Add Fluentd chart --- bitnami/fluentd/.helmignore | 22 ++ bitnami/fluentd/Chart.yaml | 19 ++ bitnami/fluentd/templates/NOTES.txt | 21 ++ bitnami/fluentd/templates/_helpers.tpl | 129 ++++++++++ .../templates/aggregator-configmap.yaml | 24 ++ .../templates/aggregator-statefulset.yaml | 91 +++++++ bitnami/fluentd/templates/configmap.yaml | 12 + .../templates/forwarder-configmap.yaml | 50 ++++ .../templates/forwarder-daemonset.yaml | 97 ++++++++ bitnami/fluentd/templates/ingress.yaml | 36 +++ bitnami/fluentd/templates/svc-headless.yaml | 18 ++ bitnami/fluentd/templates/svc.yaml | 25 ++ bitnami/fluentd/values.yaml | 229 ++++++++++++++++++ 13 files changed, 773 insertions(+) create mode 100644 bitnami/fluentd/.helmignore create mode 100644 bitnami/fluentd/Chart.yaml create mode 100644 bitnami/fluentd/templates/NOTES.txt create mode 100644 bitnami/fluentd/templates/_helpers.tpl create mode 100644 bitnami/fluentd/templates/aggregator-configmap.yaml create mode 100644 bitnami/fluentd/templates/aggregator-statefulset.yaml create mode 100644 bitnami/fluentd/templates/configmap.yaml create mode 100644 bitnami/fluentd/templates/forwarder-configmap.yaml create mode 100644 bitnami/fluentd/templates/forwarder-daemonset.yaml create mode 100644 bitnami/fluentd/templates/ingress.yaml create mode 100644 bitnami/fluentd/templates/svc-headless.yaml create mode 100644 bitnami/fluentd/templates/svc.yaml create mode 100644 bitnami/fluentd/values.yaml diff --git a/bitnami/fluentd/.helmignore b/bitnami/fluentd/.helmignore new file mode 100644 index 000000000..50af03172 --- /dev/null +++ b/bitnami/fluentd/.helmignore @@ -0,0 +1,22 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/bitnami/fluentd/Chart.yaml b/bitnami/fluentd/Chart.yaml new file mode 100644 index 000000000..11cdd5c63 --- /dev/null +++ b/bitnami/fluentd/Chart.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +name: fluentd +version: 0.1.0 +appVersion: 1.7.1 +description: Fluentd is an open source data collector for unified logging layer +keywords: +- fluentd +- logging +- logs +- data +- collector +home: https://www.fluentd.org/ +sources: +- https://github.com/bitnami/bitnami-docker-fluentd +maintainers: +- name: Bitnami + email: containers@bitnami.com +engine: gotpl +icon: https://bitnami.com/assets/stacks/fluentd/img/fluentd-stack-110x117.png \ No newline at end of file diff --git a/bitnami/fluentd/templates/NOTES.txt b/bitnami/fluentd/templates/NOTES.txt new file mode 100644 index 000000000..746b70e29 --- /dev/null +++ b/bitnami/fluentd/templates/NOTES.txt @@ -0,0 +1,21 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "fluentd.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "fluentd.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "fluentd.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "fluentd.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/bitnami/fluentd/templates/_helpers.tpl b/bitnami/fluentd/templates/_helpers.tpl new file mode 100644 index 000000000..193cb985e --- /dev/null +++ b/bitnami/fluentd/templates/_helpers.tpl @@ -0,0 +1,129 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "fluentd.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "fluentd.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "fluentd.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "fluentd.labels" -}} +app.kubernetes.io/name: {{ include "fluentd.name" . }} +helm.sh/chart: {{ include "fluentd.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Return the proper Fluentd image name +*/}} +{{- define "fluentd.image" -}} +{{- $registryName := .Values.image.registry -}} +{{- $repositoryName := .Values.image.repository -}} +{{- $tag := .Values.image.tag | toString -}} +{{/* +Helm 2.11 supports the assignment of a value to a variable defined in a different scope, +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 -}} +{{- else -}} + {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} +{{- end -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "fluentd.imagePullSecrets" -}} +{{/* +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. +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 }} + - name: {{ . }} +{{- end }} +{{- else if .Values.image.pullSecrets }} +imagePullSecrets: +{{- range .Values.image.pullSecrets }} + - 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 -}} \ No newline at end of file diff --git a/bitnami/fluentd/templates/aggregator-configmap.yaml b/bitnami/fluentd/templates/aggregator-configmap.yaml new file mode 100644 index 000000000..363df924b --- /dev/null +++ b/bitnami/fluentd/templates/aggregator-configmap.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "fluentd.fullname" . }}-aggregator-cm + labels: {{ include "fluentd.labels" . | nindent 4 }} +data: + aggregator.conf: | + # TCP input + + @type forward + bind 0.0.0.0 + port 24444 + + + # HTTP input + + @type http + bind 0.0.0.0 + port 9880 + + + + @type stdout + diff --git a/bitnami/fluentd/templates/aggregator-statefulset.yaml b/bitnami/fluentd/templates/aggregator-statefulset.yaml new file mode 100644 index 000000000..971e1f53e --- /dev/null +++ b/bitnami/fluentd/templates/aggregator-statefulset.yaml @@ -0,0 +1,91 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "fluentd.fullname" . }} + labels: + {{- include "fluentd.labels" . | nindent 4 }} + app.kubernetes.io/component: aggregator +spec: + selector: + matchLabels: + app.kubernetes.io/name: {{ include "fluentd.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: aggregator + serviceName: {{ include "fluentd.fullname" . }}-headless + replicas: {{ .Values.aggregator.replicaCount }} + updateStrategy: + {{- toYaml .Values.aggregator.updateStrategy | nindent 4 }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "fluentd.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: aggregator + annotations: + checksum/config: {{ include (print $.Template.BasePath "/aggregator-configmap.yaml") . | sha256sum }} + {{- if .Values.aggregator.podAnnotations }} + {{- toYaml .Values.aggregator.podAnnotations | nindent 8 }} + {{- end }} + spec: + {{- include "fluentd.imagePullSecrets" . | nindent 6 }} + {{- if .Values.securityContext.enabled }} + securityContext: + runAsUser: {{ .Values.securityContext.runAsUser }} + fsGroup: {{ .Values.securityContext.fsGroup }} + runAsNonRoot: {{ .Values.securityContext.runAsNonRoot }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: {{ include "fluentd.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: FLUENTD_CONF + value: {{ default "fluentd.conf" .Values.forwarder.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: 24444 + protocol: TCP + livenessProbe: + httpGet: + path: /fluentd.healthcheck?json=%7B%22ping%22%3A+%22pong%22%7D + port: 9880 + initialDelaySeconds: 5 + timeoutSeconds: 1 + resources: {{ toYaml .Values.aggregator.resources | nindent 12 }} + volumeMounts: + - name: fluentd-config-file + mountPath: /opt/bitnami/fluentd/conf/fluentd.conf + subPath: fluentd.conf + - name: fluentd-extra-config + mountPath: /opt/bitnami/fluentd/conf/conf.d + - name: buffer + mountPath: /opt/bitnami/fluentd/logs/buffers + volumes: + - name: fluentd-config-file + configMap: + name: {{ include "fluentd.fullname" . }}-cm + - name: fluentd-extra-config + configMap: + name: {{ include "fluentd.fullname" . }}-aggregator-cm + - name: buffer + emptyDir: {} + {{- with .Values.aggregator.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.aggregator.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.aggregator.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/bitnami/fluentd/templates/configmap.yaml b/bitnami/fluentd/templates/configmap.yaml new file mode 100644 index 000000000..e97ff4994 --- /dev/null +++ b/bitnami/fluentd/templates/configmap.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "fluentd.fullname" . }}-cm + labels: {{ include "fluentd.labels" . | nindent 4 }} +data: + fluentd.conf: | + + @type null + + + @include conf.d/*.conf diff --git a/bitnami/fluentd/templates/forwarder-configmap.yaml b/bitnami/fluentd/templates/forwarder-configmap.yaml new file mode 100644 index 000000000..192df4e3c --- /dev/null +++ b/bitnami/fluentd/templates/forwarder-configmap.yaml @@ -0,0 +1,50 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "fluentd.fullname" . }}-forwarder-cm + labels: {{ include "fluentd.labels" . | nindent 4 }} +data: + forwarder.conf: | + # TCP input + + @type forward + port 24444 + + + # HTTP input + + @type http + port 9880 + + + + @type tail + @id in_tail_docker + path /var/log/docker.log + tag docker + + @type regexp + expression /^time="(? + + + # Log Forwarding + + @type forward + {{- $fullName := (include "fluentd.fullname" .) }} + {{- $global := . }} + {{- $domain := .Values.clusterDomain }} + {{- range $i, $e := until (.Values.aggregator.replicaCount | int) }} + + {{ printf "host %s-%d.%s-headless.%s.svc.%s" $fullName $i $fullName $global.Release.Namespace $domain }} + port 24444 + {{- if ne $i 0 }} + standby + {{- end }} + + {{- end}} + + + flush_interval 10s + + diff --git a/bitnami/fluentd/templates/forwarder-daemonset.yaml b/bitnami/fluentd/templates/forwarder-daemonset.yaml new file mode 100644 index 000000000..3efa8b524 --- /dev/null +++ b/bitnami/fluentd/templates/forwarder-daemonset.yaml @@ -0,0 +1,97 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: {{ include "fluentd.fullname" . }} + labels: + {{- include "fluentd.labels" . | nindent 4 }} + app.kubernetes.io/component: forwarder +spec: + selector: + matchLabels: + app.kubernetes.io/name: {{ include "fluentd.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: forwarder + updateStrategy: + {{- toYaml .Values.forwarder.updateStrategy | nindent 4 }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "fluentd.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: forwarder + annotations: + checksum/config: {{ include (print $.Template.BasePath "/forwarder-configmap.yaml") . | sha256sum }} + {{- if .Values.forwarder.podAnnotations }} + {{- toYaml .Values.forwarder.podAnnotations | nindent 8 }} + {{- end }} + spec: + {{- include "fluentd.imagePullSecrets" . | nindent 6 }} + {{- if .Values.securityContext.enabled }} + securityContext: + runAsUser: {{ .Values.securityContext.runAsUser }} + fsGroup: {{ .Values.securityContext.fsGroup }} + runAsNonRoot: {{ .Values.securityContext.runAsNonRoot }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: {{ include "fluentd.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: FLUENTD_CONF + value: {{ default "fluentd.conf" .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 + livenessProbe: + httpGet: + path: /fluentd.healthcheck?json=%7B%22daemonset%22%3A+%22pong%22%7D + port: 9880 + initialDelaySeconds: 5 + timeoutSeconds: 1 + resources: {{ toYaml .Values.forwarder.resources | nindent 12 }} + volumeMounts: + - name: fluentd-config-file + mountPath: /opt/bitnami/fluentd/conf/fluentd.conf + subPath: fluentd.conf + - name: fluentd-extra-config + mountPath: /opt/bitnami/fluentd/conf/conf.d + - name: buffer + mountPath: /opt/bitnami/fluentd/logs/buffers + - name: varlog + mountPath: /var/log + - name: varlibdockercontainers + mountPath: /var/lib/docker/containers + readOnly: true + volumes: + - name: fluentd-config-file + configMap: + name: {{ include "fluentd.fullname" . }}-cm + - name: fluentd-extra-config + configMap: + name: {{ include "fluentd.fullname" . }}-forwarder-cm + - 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 }} + {{- end }} + {{- with .Values.forwarder.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.forwarder.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/bitnami/fluentd/templates/ingress.yaml b/bitnami/fluentd/templates/ingress.yaml new file mode 100644 index 000000000..b0febc2ff --- /dev/null +++ b/bitnami/fluentd/templates/ingress.yaml @@ -0,0 +1,36 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "fluentd.fullname" . -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ $fullName }} + labels: +{{ include "fluentd.labels" . | indent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ . }} + backend: + serviceName: {{ $fullName }} + servicePort: http + {{- end }} + {{- end }} +{{- end }} diff --git a/bitnami/fluentd/templates/svc-headless.yaml b/bitnami/fluentd/templates/svc-headless.yaml new file mode 100644 index 000000000..453ecb384 --- /dev/null +++ b/bitnami/fluentd/templates/svc-headless.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "fluentd.fullname" . }}-headless + labels: + {{- include "fluentd.labels" . | nindent 4 }} + app.kubernetes.io/component: aggregator +spec: + type: ClusterIP + clusterIP: None + ports: + - name: tcp + port: 24444 + targetPort: tcp + selector: + app.kubernetes.io/name: {{ include "fluentd.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: aggregator \ No newline at end of file diff --git a/bitnami/fluentd/templates/svc.yaml b/bitnami/fluentd/templates/svc.yaml new file mode 100644 index 000000000..0570642f3 --- /dev/null +++ b/bitnami/fluentd/templates/svc.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "fluentd.fullname" . }} + labels: + {{- include "fluentd.labels" . | nindent 4 }} + app.kubernetes.io/component: forwarder +spec: + type: {{ .Values.service.type }} + {{- if .Values.service.nodePort }} + nodePort: {{ .Values.service.nodePort }} + {{- end }} + {{- if eq .Values.service.type "LoadBalancer" }} {{- if .Values.service.loadBalancerIP }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} {{- end }} + type: {{ .Values.service.type }} + ports: + - name: http + targetPort: http + protocol: TCP + port: {{ .Values.service.port }} + selector: + app.kubernetes.io/name: {{ include "fluentd.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: forwarder diff --git a/bitnami/fluentd/values.yaml b/bitnami/fluentd/values.yaml new file mode 100644 index 000000000..3d5a494b4 --- /dev/null +++ b/bitnami/fluentd/values.yaml @@ -0,0 +1,229 @@ +## 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 +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +clusterDomain: cluster.local + +## Bitnami Fluentd image version +## ref: https://hub.docker.com/r/bitnami/fluentd/tags/ +## +image: + registry: docker.io + repository: bitnami/fluentd + tag: 1.7.1-debian-9-r0 + ## Specify a imagePullPolicy + ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' + ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images + ## + pullPolicy: IfNotPresent + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName + +## String to partially override fluentd.fullname template (will maintain the release name) +## +# nameOverride: + +## String to fully override fluentd.fullname template +## +# fullnameOverride: + +forwarder: + ## Name of the config file that will be used by Fluentd at launch + ## Fluentd will look for it under the /opt/bitnami/fluentd/conf directory + ## + # configFile: fluentd.conf + + ## String with extra arguments for the Fluentd command line + ## ref: https://docs.fluentd.org/deployment/command-line-option + ## + extraArgs: "" + + ## Extra environment variables to pass to the container + ## extraEnv: + ## - name: MY_ENV_VAR + ## - value: my_value + ## + extraEnv: {} + + ## Configure extra options for liveness and readiness probes + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes) + ## + livenessProbe: + initialDelaySeconds: 120 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + readinessProbe: + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + + ## Set up update strategy. + ## ref: https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/#daemonset-update-strategy + ## Example: + # updateStrategy: + # type: RollingUpdate + # rollingUpdate: + # maxSurge: 25% + # maxUnavailable: 25% + updateStrategy: + type: RollingUpdate + + ## Configure resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## Example: + ## resources: + ## requests: + ## memory: 512Mi + ## cpu: 300m + ## + # resources: + + ## Node labels for pod assignment + ## Ref: https://kubernetes.io/docs/user-guide/node-selection/ + ## + nodeSelector: {} + + ## Tolerations for pod assignment + ## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + ## + tolerations: [] + + ## Affinity for pod assignment + ## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity + ## + affinity: {} + + ## Pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: {} + + +aggregator: + ## Number of aggregator replicas + ## + replicaCount: 2 + + ## Name of the config file that will be used by Fluentd at launch + ## Fluentd will look for it under the /opt/bitnami/fluentd/conf directory + ## + # configFile: fluentd.conf + + ## String with extra arguments for the Fluentd command line + ## ref: https://docs.fluentd.org/deployment/command-line-option + ## + extraArgs: "" + + ## Extra environment variables to pass to the container + ## extraEnv: + ## - name: MY_ENV_VAR + ## - value: my_value + ## + extraEnv: {} + + ## Configure extra options for liveness and readiness probes + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes) + ## + livenessProbe: + initialDelaySeconds: 120 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + readinessProbe: + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + + ## Set up update strategy. + ## ref: https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#updating-statefulsets + ## Example: + # updateStrategy: + # type: RollingUpdate + # rollingUpdate: + # maxSurge: 25% + # maxUnavailable: 25% + updateStrategy: + type: RollingUpdate + + ## Configure resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## Example: + ## resources: + ## requests: + ## memory: 512Mi + ## cpu: 300m + ## + # resources: + + ## Node labels for pod assignment + ## Ref: https://kubernetes.io/docs/user-guide/node-selection/ + ## + nodeSelector: {} + + ## Tolerations for pod assignment + ## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + ## + tolerations: [] + + ## Affinity for pod assignment + ## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity + ## + affinity: {} + + ## Pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: {} + + + + + + + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: [] + + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + + +## SecurityContext configuration +## +securityContext: + enabled: true + runAsUser: 1001 + fsGroup: 1001 + runAsNonRoot: true + + + From 06609602ebca10a8ff4d16cbf68598cda2052972 Mon Sep 17 00:00:00 2001 From: Alejandro Moreno Date: Tue, 24 Sep 2019 10:41:57 +0000 Subject: [PATCH 02/10] Add Fluentd to the list of charts --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f70733ad3..af0fd5255 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ $ helm search bitnami - [Cassandra](https://github.com/bitnami/charts/tree/master/bitnami/cassandra) - [Elasticsearch](https://github.com/bitnami/charts/tree/master/bitnami/elasticsearch) - [etcd](https://github.com/bitnami/charts/tree/master/bitnami/etcd) +- [Fluentd](https://github.com/bitnami/charts/tree/master/bitnami/fluentd) - [Grafana](https://github.com/bitnami/charts/tree/master/bitnami/grafana) - [Harbor](https://github.com/bitnami/charts/tree/master/bitnami/harbor) - [HashiCorp Consul](https://github.com/bitnami/charts/tree/master/bitnami/consul) From 3f759e0df7e0932685630236018591cf15e8f860 Mon Sep 17 00:00:00 2001 From: Alejandro Moreno Date: Tue, 24 Sep 2019 14:41:42 +0000 Subject: [PATCH 03/10] Add RBAC support to read logs from the k8s node --- bitnami/fluentd/Chart.yaml | 2 +- bitnami/fluentd/templates/_helpers.tpl | 13 +++++++- .../templates/aggregator-configmap.yaml | 12 +++++-- .../templates/aggregator-statefulset.yaml | 16 ++++++++++ bitnami/fluentd/templates/certs.yaml | 15 +++++++++ bitnami/fluentd/templates/clusterrole.yaml | 18 +++++++++++ .../fluentd/templates/clusterrolebinding.yaml | 16 ++++++++++ bitnami/fluentd/templates/configmap.yaml | 4 --- .../templates/forwarder-configmap.yaml | 31 ++++++++++++++++--- .../templates/forwarder-daemonset.yaml | 19 +++++++++++- bitnami/fluentd/templates/serviceaccount.yaml | 8 +++++ bitnami/fluentd/values.yaml | 31 +++++++++++++++---- 12 files changed, 165 insertions(+), 20 deletions(-) create mode 100644 bitnami/fluentd/templates/certs.yaml create mode 100644 bitnami/fluentd/templates/clusterrole.yaml create mode 100644 bitnami/fluentd/templates/clusterrolebinding.yaml create mode 100644 bitnami/fluentd/templates/serviceaccount.yaml diff --git a/bitnami/fluentd/Chart.yaml b/bitnami/fluentd/Chart.yaml index 11cdd5c63..532e37741 100644 --- a/bitnami/fluentd/Chart.yaml +++ b/bitnami/fluentd/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 name: fluentd version: 0.1.0 -appVersion: 1.7.1 +appVersion: 1.7.2 description: Fluentd is an open source data collector for unified logging layer keywords: - fluentd diff --git a/bitnami/fluentd/templates/_helpers.tpl b/bitnami/fluentd/templates/_helpers.tpl index 193cb985e..ddb842ff2 100644 --- a/bitnami/fluentd/templates/_helpers.tpl +++ b/bitnami/fluentd/templates/_helpers.tpl @@ -126,4 +126,15 @@ but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else {{- end -}} {{- end -}} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "fluentd.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "fluentd.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/bitnami/fluentd/templates/aggregator-configmap.yaml b/bitnami/fluentd/templates/aggregator-configmap.yaml index 363df924b..c638947dc 100644 --- a/bitnami/fluentd/templates/aggregator-configmap.yaml +++ b/bitnami/fluentd/templates/aggregator-configmap.yaml @@ -5,6 +5,10 @@ metadata: labels: {{ include "fluentd.labels" . | nindent 4 }} data: aggregator.conf: | + + @type null + + # TCP input @type forward @@ -19,6 +23,10 @@ data: port 9880 - + @type stdout - + + + + @type stdout + diff --git a/bitnami/fluentd/templates/aggregator-statefulset.yaml b/bitnami/fluentd/templates/aggregator-statefulset.yaml index 971e1f53e..08c438d1d 100644 --- a/bitnami/fluentd/templates/aggregator-statefulset.yaml +++ b/bitnami/fluentd/templates/aggregator-statefulset.yaml @@ -68,7 +68,23 @@ spec: mountPath: /opt/bitnami/fluentd/conf/conf.d - name: buffer mountPath: /opt/bitnami/fluentd/logs/buffers + {{- if .Values.tls.enabled }} + - name: {{ template "fluentd.fullname" . }}-certs + mountPath: /opt/bitnami/fluentd/certs + {{- end }} volumes: + {{- 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 + {{- end }} - name: fluentd-config-file configMap: name: {{ include "fluentd.fullname" . }}-cm diff --git a/bitnami/fluentd/templates/certs.yaml b/bitnami/fluentd/templates/certs.yaml new file mode 100644 index 000000000..3fb1bba8b --- /dev/null +++ b/bitnami/fluentd/templates/certs.yaml @@ -0,0 +1,15 @@ +{{- if and (not .Values.tls.existingSecret) ( .Values.tls.enabled) }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "fluentd.fullname" . }}-certs + labels: {{ include "fluentd.labels" . | nindent 4 }} +type: Opaque +data: + ca_certificate.pem: + {{ required "A valid .Values.tls.caCertificate entry required!" .Values.tls.caCertificate | b64enc | quote }} + server_certificate.pem: + {{ required "A valid .Values.tls.serverCertificate entry required!" .Values.tls.serverCertificate| b64enc | quote }} + server_key.pem: + {{ required "A valid .Values.tls.serverKey entry required!" .Values.tls.serverKey | b64enc | quote }} +{{- end }} diff --git a/bitnami/fluentd/templates/clusterrole.yaml b/bitnami/fluentd/templates/clusterrole.yaml new file mode 100644 index 000000000..6d6368906 --- /dev/null +++ b/bitnami/fluentd/templates/clusterrole.yaml @@ -0,0 +1,18 @@ +{{- if and .Values.serviceAccount.create .Values.rbac.create }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "fluentd.fullname" . }} + labels: + {{- include "fluentd.labels" . | nindent 4 }} +rules: +- apiGroups: + - "" + resources: + - "namespaces" + - "pods" + verbs: + - "get" + - "watch" + - "list" +{{- end }} diff --git a/bitnami/fluentd/templates/clusterrolebinding.yaml b/bitnami/fluentd/templates/clusterrolebinding.yaml new file mode 100644 index 000000000..8e4662983 --- /dev/null +++ b/bitnami/fluentd/templates/clusterrolebinding.yaml @@ -0,0 +1,16 @@ +{{- if and .Values.serviceAccount.create .Values.rbac.create }} +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: {{ include "fluentd.fullname" . }} + labels: + {{- include "fluentd.labels" . | nindent 4 }} +roleRef: + kind: ClusterRole + apiGroup: rbac.authorization.k8s.io + name: {{ template "fluentd.fullname" . }} +subjects: +- kind: ServiceAccount + name: {{ template "fluentd.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/bitnami/fluentd/templates/configmap.yaml b/bitnami/fluentd/templates/configmap.yaml index e97ff4994..0030d95a3 100644 --- a/bitnami/fluentd/templates/configmap.yaml +++ b/bitnami/fluentd/templates/configmap.yaml @@ -5,8 +5,4 @@ metadata: labels: {{ include "fluentd.labels" . | nindent 4 }} data: fluentd.conf: | - - @type null - - @include conf.d/*.conf diff --git a/bitnami/fluentd/templates/forwarder-configmap.yaml b/bitnami/fluentd/templates/forwarder-configmap.yaml index 192df4e3c..827413f97 100644 --- a/bitnami/fluentd/templates/forwarder-configmap.yaml +++ b/bitnami/fluentd/templates/forwarder-configmap.yaml @@ -5,6 +5,10 @@ metadata: labels: {{ include "fluentd.labels" . | nindent 4 }} data: forwarder.conf: | + + @type null + + # TCP input @type forward @@ -19,21 +23,38 @@ data: @type tail - @id in_tail_docker - path /var/log/docker.log - tag docker + path /var/log/containers/*.log + pos_file /opt/bitnami/fluentd/logs/buffers/fluentd-docker.pos + tag kubernetes.* @type regexp - expression /^time="(? + + @type stdout + + + + @type null + + + + @type null + + + + @type kubernetes_metadata + + # Log Forwarding @type forward {{- $fullName := (include "fluentd.fullname" .) }} {{- $global := . }} - {{- $domain := .Values.clusterDomain }} + {{- $domain := default "cluster.local" .Values.clusterDomain }} {{- range $i, $e := until (.Values.aggregator.replicaCount | int) }} {{ printf "host %s-%d.%s-headless.%s.svc.%s" $fullName $i $fullName $global.Release.Namespace $domain }} diff --git a/bitnami/fluentd/templates/forwarder-daemonset.yaml b/bitnami/fluentd/templates/forwarder-daemonset.yaml index 3efa8b524..087f87633 100644 --- a/bitnami/fluentd/templates/forwarder-daemonset.yaml +++ b/bitnami/fluentd/templates/forwarder-daemonset.yaml @@ -26,6 +26,7 @@ spec: {{- end }} spec: {{- include "fluentd.imagePullSecrets" . | nindent 6 }} + serviceAccountName: {{ template "fluentd.serviceAccountName" . }} {{- if .Values.securityContext.enabled }} securityContext: runAsUser: {{ .Values.securityContext.runAsUser }} @@ -50,7 +51,7 @@ spec: protocol: TCP livenessProbe: httpGet: - path: /fluentd.healthcheck?json=%7B%22daemonset%22%3A+%22pong%22%7D + path: /fluentd.healthcheck?json=%7B%22ping%22%3A+%22pong%22%7D port: 9880 initialDelaySeconds: 5 timeoutSeconds: 1 @@ -63,12 +64,28 @@ spec: mountPath: /opt/bitnami/fluentd/conf/conf.d - 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 readOnly: true volumes: + {{- 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 + {{- end }} - name: fluentd-config-file configMap: name: {{ include "fluentd.fullname" . }}-cm diff --git a/bitnami/fluentd/templates/serviceaccount.yaml b/bitnami/fluentd/templates/serviceaccount.yaml new file mode 100644 index 000000000..d5f4ea151 --- /dev/null +++ b/bitnami/fluentd/templates/serviceaccount.yaml @@ -0,0 +1,8 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "fluentd.serviceAccountName" . }} + labels: + {{- include "fluentd.labels" . | nindent 4 }} +{{- end -}} \ No newline at end of file diff --git a/bitnami/fluentd/values.yaml b/bitnami/fluentd/values.yaml index 3d5a494b4..89e532f27 100644 --- a/bitnami/fluentd/values.yaml +++ b/bitnami/fluentd/values.yaml @@ -8,15 +8,13 @@ # - myRegistryKeySecretName # storageClass: myStorageClass -clusterDomain: cluster.local - ## Bitnami Fluentd image version ## ref: https://hub.docker.com/r/bitnami/fluentd/tags/ ## image: registry: docker.io repository: bitnami/fluentd - tag: 1.7.1-debian-9-r0 + tag: 1.7.2-debian-9-r3 ## Specify a imagePullPolicy ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images @@ -37,6 +35,9 @@ image: ## # fullnameOverride: +## Cluster Domain +clusterDomain: cluster.local + forwarder: ## Name of the config file that will be used by Fluentd at launch ## Fluentd will look for it under the /opt/bitnami/fluentd/conf directory @@ -112,7 +113,6 @@ forwarder: ## podAnnotations: {} - aggregator: ## Number of aggregator replicas ## @@ -192,10 +192,29 @@ aggregator: ## podAnnotations: {} +tls: + enabled: false + caCertificate: |- + serverCertificate: |- + serverKey: |- + # existingSecret: name-of-existing-secret-to-certificates +## Pods Service Account +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ +## +serviceAccount: + ## Specifies whether a ServiceAccount should be created + ## + 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 + # name: - - +## Role Based Access +## Ref: https://kubernetes.io/docs/admin/authorization/rbac/ +## +rbac: + create: true service: From a5c30bf379bad5e583167cda4e65039d18f0c53d Mon Sep 17 00:00:00 2001 From: Alejandro Moreno Date: Wed, 25 Sep 2019 10:18:08 +0000 Subject: [PATCH 04/10] Add Prometheus metrics support --- .../templates/forwarder-configmap.yaml | 33 +++++++++++++++++++ .../templates/forwarder-daemonset.yaml | 5 +++ bitnami/fluentd/templates/svc.yaml | 21 +++++++++--- bitnami/fluentd/values.yaml | 13 +++++++- 4 files changed, 67 insertions(+), 5 deletions(-) diff --git a/bitnami/fluentd/templates/forwarder-configmap.yaml b/bitnami/fluentd/templates/forwarder-configmap.yaml index 827413f97..83a7720ed 100644 --- a/bitnami/fluentd/templates/forwarder-configmap.yaml +++ b/bitnami/fluentd/templates/forwarder-configmap.yaml @@ -69,3 +69,36 @@ data: flush_interval 10s + {{- if .Values.metrics.enabled }} + metrics.conf: | + # Prometheus Exporter Plugin + # input plugin that exports metrics + + @type prometheus + port {{ .Values.metrics.service.port }} + + + # input plugin that collects metrics from MonitorAgent + + @type prometheus_monitor + + host ${hostname} + + + + # input plugin that collects metrics for output plugin + + @type prometheus_output_monitor + + host ${hostname} + + + + # input plugin that collects metrics for in_tail plugin + + @type prometheus_tail_monitor + + host ${hostname} + + + {{- end }} diff --git a/bitnami/fluentd/templates/forwarder-daemonset.yaml b/bitnami/fluentd/templates/forwarder-daemonset.yaml index 087f87633..0b073027c 100644 --- a/bitnami/fluentd/templates/forwarder-daemonset.yaml +++ b/bitnami/fluentd/templates/forwarder-daemonset.yaml @@ -49,6 +49,11 @@ spec: - name: http containerPort: 9880 protocol: TCP + {{- if .Values.metrics.enabled }} + - name: metrics + containerPort: {{ .Values.metrics.service.port }} + protocol: TCP + {{- end }} livenessProbe: httpGet: path: /fluentd.healthcheck?json=%7B%22ping%22%3A+%22pong%22%7D diff --git a/bitnami/fluentd/templates/svc.yaml b/bitnami/fluentd/templates/svc.yaml index 0570642f3..970cb1166 100644 --- a/bitnami/fluentd/templates/svc.yaml +++ b/bitnami/fluentd/templates/svc.yaml @@ -5,11 +5,17 @@ metadata: labels: {{- include "fluentd.labels" . | nindent 4 }} app.kubernetes.io/component: forwarder +{{- if or (and .Values.metrics.enabled .Values.metrics.service.annotations) .Values.service.annotations }} + annotations: + {{- if and .Values.metrics.enabled .Values.metrics.service.annotations }} + {{- tpl (toYaml .Values.metrics.service.annotations) $ | nindent 4 }} + {{- end }} + {{- if and .Values.service.annotations }} + {{- tpl (toYaml .Values.service.annotations) $ | nindent 4 }} + {{- end }} +{{- end }} spec: type: {{ .Values.service.type }} - {{- if .Values.service.nodePort }} - nodePort: {{ .Values.service.nodePort }} - {{- end }} {{- if eq .Values.service.type "LoadBalancer" }} {{- if .Values.service.loadBalancerIP }} loadBalancerIP: {{ .Values.service.loadBalancerIP }} {{- end }} {{- end }} @@ -17,8 +23,15 @@ spec: ports: - name: http targetPort: http - protocol: TCP port: {{ .Values.service.port }} + {{- if .Values.service.nodePort }} + nodePort: {{ .Values.service.nodePort }} + {{- end }} + {{- if .Values.metrics.enabled }} + - name: metrics + port: {{ .Values.metrics.service.port }} + targetPort: metrics + {{- end }} selector: app.kubernetes.io/name: {{ include "fluentd.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/bitnami/fluentd/values.yaml b/bitnami/fluentd/values.yaml index 89e532f27..94dd0df20 100644 --- a/bitnami/fluentd/values.yaml +++ b/bitnami/fluentd/values.yaml @@ -211,11 +211,22 @@ serviceAccount: # name: ## Role Based Access -## Ref: https://kubernetes.io/docs/admin/authorization/rbac/ +## ref: https://kubernetes.io/docs/admin/authorization/rbac/ ## rbac: create: true +## Prometheus metrics +## ref: https://github.com/fluent/fluent-plugin-prometheus/blob/master/README.md +## +metrics: + enabled: false + service: + port: 24231 + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "24231" + prometheus.io/path: "/metrics" service: type: ClusterIP From be0f29f6c7b0930abf2702762b4e86c1a27a6c47 Mon Sep 17 00:00:00 2001 From: Alejandro Moreno Date: Wed, 25 Sep 2019 13:51:01 +0000 Subject: [PATCH 05/10] Allow port configuration --- .../templates/aggregator-configmap.yaml | 2 +- .../templates/aggregator-statefulset.yaml | 4 +- .../templates/forwarder-configmap.yaml | 18 +++---- .../templates/forwarder-daemonset.yaml | 9 ++-- bitnami/fluentd/templates/svc-headless.yaml | 2 +- bitnami/fluentd/templates/svc.yaml | 24 ++++----- bitnami/fluentd/values.yaml | 49 ++++++++++++++++--- 7 files changed, 67 insertions(+), 41 deletions(-) diff --git a/bitnami/fluentd/templates/aggregator-configmap.yaml b/bitnami/fluentd/templates/aggregator-configmap.yaml index c638947dc..0df416e30 100644 --- a/bitnami/fluentd/templates/aggregator-configmap.yaml +++ b/bitnami/fluentd/templates/aggregator-configmap.yaml @@ -13,7 +13,7 @@ data: @type forward bind 0.0.0.0 - port 24444 + port {{ .Values.aggregator.port }} # HTTP input diff --git a/bitnami/fluentd/templates/aggregator-statefulset.yaml b/bitnami/fluentd/templates/aggregator-statefulset.yaml index 08c438d1d..6a111d02c 100644 --- a/bitnami/fluentd/templates/aggregator-statefulset.yaml +++ b/bitnami/fluentd/templates/aggregator-statefulset.yaml @@ -40,7 +40,7 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: FLUENTD_CONF - value: {{ default "fluentd.conf" .Values.forwarder.configFile }} + value: {{ default "fluentd.conf" .Values.aggregator.configFile }} - name: FLUENTD_OPT value: {{ .Values.aggregator.extraArgs }} {{- if .Values.aggregator.extraEnv }} @@ -51,7 +51,7 @@ spec: containerPort: 9880 protocol: TCP - name: tcp - containerPort: 24444 + containerPort: {{ .Values.aggregator.port }} protocol: TCP livenessProbe: httpGet: diff --git a/bitnami/fluentd/templates/forwarder-configmap.yaml b/bitnami/fluentd/templates/forwarder-configmap.yaml index 83a7720ed..240dc1b19 100644 --- a/bitnami/fluentd/templates/forwarder-configmap.yaml +++ b/bitnami/fluentd/templates/forwarder-configmap.yaml @@ -12,7 +12,7 @@ data: # TCP input @type forward - port 24444 + port {{ .Values.forwarder.service.port }} # HTTP input @@ -24,27 +24,22 @@ data: @type tail path /var/log/containers/*.log + # exclude Fluentd logs + exclude_path /var/log/containers/{{ include "fluentd.fullname" . }}*.log pos_file /opt/bitnami/fluentd/logs/buffers/fluentd-docker.pos tag kubernetes.* + read_from_head true @type regexp expression /^(? - + @type stdout - - @type null - - - - @type null - - @type kubernetes_metadata @@ -55,10 +50,11 @@ data: {{- $fullName := (include "fluentd.fullname" .) }} {{- $global := . }} {{- $domain := default "cluster.local" .Values.clusterDomain }} + {{- $port := .Values.aggregator.port | int }} {{- range $i, $e := until (.Values.aggregator.replicaCount | int) }} {{ printf "host %s-%d.%s-headless.%s.svc.%s" $fullName $i $fullName $global.Release.Namespace $domain }} - port 24444 + {{ printf "port %d" $port }} {{- if ne $i 0 }} standby {{- end }} diff --git a/bitnami/fluentd/templates/forwarder-daemonset.yaml b/bitnami/fluentd/templates/forwarder-daemonset.yaml index 0b073027c..92f36a2ec 100644 --- a/bitnami/fluentd/templates/forwarder-daemonset.yaml +++ b/bitnami/fluentd/templates/forwarder-daemonset.yaml @@ -46,6 +46,9 @@ spec: {{- toYaml .Values.forwarder.extraEnv | nindent 12 }} {{- end }} ports: + - name: tcp + containerPort: {{ .Values.forwarder.service.port }} + protocol: TCP - name: http containerPort: 9880 protocol: TCP @@ -75,9 +78,6 @@ spec: {{- end }} - name: varlog mountPath: /var/log - - name: varlibdockercontainers - mountPath: /var/lib/docker/containers - readOnly: true volumes: {{- if .Values.tls.enabled }} - name: {{ template "fluentd.fullname" . }}-certs @@ -102,9 +102,6 @@ spec: - name: varlog hostPath: path: /var/log - - name: varlibdockercontainers - hostPath: - path: /var/lib/docker/containers {{- with .Values.forwarder.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/bitnami/fluentd/templates/svc-headless.yaml b/bitnami/fluentd/templates/svc-headless.yaml index 453ecb384..eace46edb 100644 --- a/bitnami/fluentd/templates/svc-headless.yaml +++ b/bitnami/fluentd/templates/svc-headless.yaml @@ -10,7 +10,7 @@ spec: clusterIP: None ports: - name: tcp - port: 24444 + port: {{ .Values.aggregator.port }} targetPort: tcp selector: app.kubernetes.io/name: {{ include "fluentd.name" . }} diff --git a/bitnami/fluentd/templates/svc.yaml b/bitnami/fluentd/templates/svc.yaml index 970cb1166..7c4992aba 100644 --- a/bitnami/fluentd/templates/svc.yaml +++ b/bitnami/fluentd/templates/svc.yaml @@ -5,27 +5,27 @@ metadata: labels: {{- include "fluentd.labels" . | nindent 4 }} app.kubernetes.io/component: forwarder -{{- if or (and .Values.metrics.enabled .Values.metrics.service.annotations) .Values.service.annotations }} +{{- if or (and .Values.metrics.enabled .Values.metrics.service.annotations) .Values.forwarder.service.annotations }} annotations: {{- if and .Values.metrics.enabled .Values.metrics.service.annotations }} {{- tpl (toYaml .Values.metrics.service.annotations) $ | nindent 4 }} {{- end }} - {{- if and .Values.service.annotations }} - {{- tpl (toYaml .Values.service.annotations) $ | nindent 4 }} + {{- if and .Values.forwarder.service.annotations }} + {{- tpl (toYaml .Values.forwarder.service.annotations) $ | nindent 4 }} {{- end }} {{- end }} spec: - type: {{ .Values.service.type }} - {{- if eq .Values.service.type "LoadBalancer" }} {{- if .Values.service.loadBalancerIP }} - loadBalancerIP: {{ .Values.service.loadBalancerIP }} + type: {{ .Values.forwarder.service.type }} + {{- if eq .Values.forwarder.service.type "LoadBalancer" }} {{- if .Values.forwarder.service.loadBalancerIP }} + loadBalancerIP: {{ .Values.forwarder.service.loadBalancerIP }} {{- end }} {{- end }} - type: {{ .Values.service.type }} + type: {{ .Values.forwarder.service.type }} ports: - - name: http - targetPort: http - port: {{ .Values.service.port }} - {{- if .Values.service.nodePort }} - nodePort: {{ .Values.service.nodePort }} + - name: tcp + targetPort: tcp + port: {{ .Values.forwarder.service.port }} + {{- if .Values.forwarder.service.nodePort }} + nodePort: {{ .Values.forwarder.service.nodePort }} {{- end }} {{- if .Values.metrics.enabled }} - name: metrics diff --git a/bitnami/fluentd/values.yaml b/bitnami/fluentd/values.yaml index 94dd0df20..bdbf7eb14 100644 --- a/bitnami/fluentd/values.yaml +++ b/bitnami/fluentd/values.yaml @@ -44,6 +44,24 @@ forwarder: ## # configFile: fluentd.conf + ## Service configuration + ## + service: + type: ClusterIP + ## Fluentd TCP forward port + port: 24224 + ## Specify the nodePort value for the LoadBalancer and NodePort service types. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport + ## + # nodePort: + ## + ## Provide any additional annotations which may be required. This can be used to + ## set the LoadBalancer service type to internal only. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer + ## + annotations: {} + # loadBalancerIP: + ## String with extra arguments for the Fluentd command line ## ref: https://docs.fluentd.org/deployment/command-line-option ## @@ -123,6 +141,10 @@ aggregator: ## # configFile: fluentd.conf + ## Port which the forwarders will connect to to send the logs + ## + port: 24224 + ## String with extra arguments for the Fluentd command line ## ref: https://docs.fluentd.org/deployment/command-line-option ## @@ -192,13 +214,6 @@ aggregator: ## podAnnotations: {} -tls: - enabled: false - caCertificate: |- - serverCertificate: |- - serverKey: |- - # existingSecret: name-of-existing-secret-to-certificates - ## Pods Service Account ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ ## @@ -230,7 +245,19 @@ metrics: service: type: ClusterIP - port: 80 + ## Fluentd TCP forward port + port: 24224 + ## Specify the nodePort value for the LoadBalancer and NodePort service types. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport + ## + # nodePort: + + ## Provide any additional annotations which may be required. This can be used to + ## set the LoadBalancer service type to internal only. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer + ## + annotations: {} + # loadBalancerIP: ingress: enabled: false @@ -246,6 +273,12 @@ ingress: # hosts: # - chart-example.local +tls: + enabled: false + caCertificate: |- + serverCertificate: |- + serverKey: |- + # existingSecret: name-of-existing-secret-to-certificates ## SecurityContext configuration ## From 5311a2808f16cbe96e79bd480a10192d162b66a5 Mon Sep 17 00:00:00 2001 From: Alejandro Moreno Date: Thu, 26 Sep 2019 07:46:40 +0000 Subject: [PATCH 06/10] Add documentation --- bitnami/fluentd/README.md | 140 +++++++++++++++++++++++++ bitnami/fluentd/templates/NOTES.txt | 47 +++++---- bitnami/fluentd/templates/ingress.yaml | 36 ------- bitnami/fluentd/values.yaml | 52 ++------- 4 files changed, 178 insertions(+), 97 deletions(-) create mode 100644 bitnami/fluentd/README.md delete mode 100644 bitnami/fluentd/templates/ingress.yaml diff --git a/bitnami/fluentd/README.md b/bitnami/fluentd/README.md new file mode 100644 index 000000000..d5e3144d3 --- /dev/null +++ b/bitnami/fluentd/README.md @@ -0,0 +1,140 @@ +# Fluentd + +[Fluentd](https://www.fluentd.org/) is an open source data collector, which lets you unify the data collection and consumption for a better use and understanding of data. + +## TL;DR; + +```console +$ helm repo add bitnami https://charts.bitnami.com/bitnami +$ helm install bitnami/fluentd +``` + +## Introduction + +This chart bootstraps a [Fluentd](https://github.com/bitnami/bitnami-docker-fluentd) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +Bitnami charts can be used with [Kubeapps](https://kubeapps.com/) for deployment and management of Helm Charts in clusters. + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```console +$ helm repo add bitnami https://charts.bitnami.com/bitnami +$ helm install bitnami/fluentd --name my-release +``` + +These commands deploy Fluentd on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` statefulset: + +```console +$ helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. Use the option `--purge` to delete all history too. + +## Configuration + +The following tables lists the configurable parameters of the kibana chart and their default values. + +| Parameter | Description | Default | +| ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | +| `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}` | +| `image.pullPolicy` | Fluentd image pull policy | `IfNotPresent` | +| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | +| `nameOverride` | String to partially override fluentd.fullname template with a string (will prepend the release name) | `nil` | +| `fullnameOverride` | String to fully override fluentd.fullname template with a string | `nil` | +| `clusterDomain` | Kubernetes DNS domain name to use | `cluster.local` | +| `forwarder.configFile` | Name of the config file that will be used by Fluentd at launch under the `/opt/bitnami/fluentd/conf` directory | `fluentd.conf` | +| `forwarder.service.type` | Kubernetes Service type | | `ClusterIP` | +| `forwarder.service.port` | Kubernetes Service port - Fluentd transport port for the forwarders | `24224` | +| `forwarder.service.nodePort` | Port to bind to for NodePort service type (client port) | `nil` | +| `forwarder.service.annotations` | Annotations for Fluentd service (evaluated as a template) | `{}` | +| `forwarder.service.loadBalancerIP` | loadBalancerIP if Fluentd service type is `LoadBalancer` | `nil` | +| `forwarder.extraArgs` | Extra arguments for the Fluentd command line | `nil` | +| `forwarder.extraEnv` | Extra environment variables to pass to the container | `{}` | +| `forwarder.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `60` | +| `forwarder.livenessProbe.periodSeconds` | How often to perform the probe | `10` | +| `forwarder.livenessProbe.timeoutSeconds` | When the probe times out | `5` | +| `forwarder.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` | +| `forwarder.livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | +| `forwarder.readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `5` | +| `forwarder.readinessProbe.periodSeconds` | How often to perform the probe | `10` | +| `forwarder.readinessProbe.timeoutSeconds` | When the probe times out | `5` | +| `forwarder.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` | +| `forwarder.readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | +| `forwarder.updateStrategy` | Update strategy for the forwarder DaemonSet | `RollingUpdate` | +| `forwarder.resources` | Configure resource requests and limits | `nil` | +| `forwarder.nodeSelector` | Node labels for pod assignment | `{}` | +| `forwarder.tolerations` | Tolerations for pod assignment | `[]` | +| `forwarder.affinity` | Affinity for pod assignment | `{}` | +| `forwarder.podAnnotations` | Pod annotations | `{}` | +| `aggregator.replicaCount` | Number of aggregator pods to deploy in the Stateful Set | `2` | +| `aggregator.configFile` | Name of the config file that will be used by Fluentd at launch under the `/opt/bitnami/fluentd/conf` directory | `fluentd.conf` | +| `aggregator.service.type` | Kubernetes Service type | | `ClusterIP` | +| `aggregator.port` | Kubernetes Service port - Fluentd transport port for the aggregators | `24224` | +| `aggregator.extraArgs` | Extra arguments for the Fluentd command line | `nil` | +| `aggregator.extraEnv` | Extra environment variables to pass to the container | `{}` | +| `aggregator.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `60` | +| `aggregator.livenessProbe.periodSeconds` | How often to perform the probe | `10` | +| `aggregator.livenessProbe.timeoutSeconds` | When the probe times out | `5` | +| `aggregator.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` | +| `aggregator.livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | +| `aggregator.readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `5` | +| `aggregator.readinessProbe.periodSeconds` | How often to perform the probe | `10` | +| `aggregator.readinessProbe.timeoutSeconds` | When the probe times out | `5` | +| `aggregator.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` | +| `aggregator.readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | +| `aggregator.updateStrategy` | Update strategy for the aggregator DaemonSet | `RollingUpdate` | +| `aggregator.resources` | Configure resource requests and limits | `nil` | +| `aggregator.nodeSelector` | Node labels for pod assignment | `{}` | +| `aggregator.tolerations` | Tolerations for pod assignment | `[]` | +| `aggregator.affinity` | Affinity for pod assignment | `{}` | +| `aggregator.podAnnotations` | Pod annotations | `{}` | +| `serviceAccount.create` | Specify whether a ServiceAccount should be created | `true` | +| `serviceAccount.name` | The name of the ServiceAccount to create | Generated using the `fluentd.fullname` template | +| `rbac.create` | Specify whether RBAC resources should be created and used | `true` | +| `metrics.enabled` | Enable the export of Prometheus metrics | `nil` | +| `metrics.service.port` | Prometheus metrics service port | `24231` | +| `metrics.service.annotations` | Annotations for Prometheus metrics service | `{}` | +| `tls.enabled` | Enable the addition of TLS certificates | | `false` | +| `tls.caCertificate` | Ca certificate | Certificate Authority (CA) bundle content | +| `tls.serverCertificate` | Server certificate | Server certificate content | +| `tls.serverKey` | Server Key | Server private key content | +| `tls.existingSecret` | Existing secret with certificate content | `nil` | +| `securityContext.enabled` | Enable security context | `true` | +| `securityContext.fsGroup` | Group ID for the container filesystem | `1001` | +| `securityContext.runAsUser` | User ID for the container | `1001` | + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```console +$ helm install --name my-release \ + --set aggregator.port=24444 bitnami/fluentd +``` + +The above command sets the aggregators to listen on port 24444. + +Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, + +```console +$ helm install --name my-release -f values.yaml bitnami/fluentd +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +## [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. + +Bitnami will release a new chart updating its containers if a new version of the main container, significant changes, or critical vulnerabilities exist. diff --git a/bitnami/fluentd/templates/NOTES.txt b/bitnami/fluentd/templates/NOTES.txt index 746b70e29..fc5c33fa7 100644 --- a/bitnami/fluentd/templates/NOTES.txt +++ b/bitnami/fluentd/templates/NOTES.txt @@ -1,21 +1,30 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range $host := .Values.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} - {{- end }} +** Please be patient while the chart is being deployed ** + + Fluentd can be accessed within the cluster on port {{ .Values.forwarder.service.port }} at {{ template "fluentd.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }} + + To access from outside the cluster execute the following commands: + +{{- if contains "NodePort" .Values.forwarder.service.type }} + + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fluentd.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + curl http://$NODE_IP:$NODE_PORT/ +{{- else if contains "LoadBalancer" .Values.forwarder.service.type }} + + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "fluentd.fullname" . }}' + + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fluentd.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + curl http://$SERVICE_IP:{{ .Values.forwarder.service.port }}/ +{{- else if contains "ClusterIP" .Values.forwarder.service.type }} + + kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "fluentd.fullname" . }} {{ .Values.forwarder.service.port }}:24224 & + curl http://127.0.0.1:24224/ {{- end }} -{{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "fluentd.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "fluentd.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "fluentd.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "fluentd.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl port-forward $POD_NAME 8080:80 + +{{- if and (contains "bitnami/" .Values.image.repository) (not (.Values.image.tag | toString | regexFind "-r\\d+$|sha256:")) }} + +WARNING: Rolling tag detected ({{ .Values.image.repository }}:{{ .Values.image.tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment. ++info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/ + {{- end }} diff --git a/bitnami/fluentd/templates/ingress.yaml b/bitnami/fluentd/templates/ingress.yaml deleted file mode 100644 index b0febc2ff..000000000 --- a/bitnami/fluentd/templates/ingress.yaml +++ /dev/null @@ -1,36 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "fluentd.fullname" . -}} -apiVersion: extensions/v1beta1 -kind: Ingress -metadata: - name: {{ $fullName }} - labels: -{{ include "fluentd.labels" . | indent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: -{{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} -{{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ . }} - backend: - serviceName: {{ $fullName }} - servicePort: http - {{- end }} - {{- end }} -{{- end }} diff --git a/bitnami/fluentd/values.yaml b/bitnami/fluentd/values.yaml index bdbf7eb14..fd6fa48b7 100644 --- a/bitnami/fluentd/values.yaml +++ b/bitnami/fluentd/values.yaml @@ -78,13 +78,13 @@ forwarder: ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes) ## livenessProbe: - initialDelaySeconds: 120 + initialDelaySeconds: 60 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 6 successThreshold: 1 readinessProbe: - initialDelaySeconds: 30 + initialDelaySeconds: 5 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 6 @@ -161,13 +161,13 @@ aggregator: ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes) ## livenessProbe: - initialDelaySeconds: 120 + initialDelaySeconds: 60 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 6 successThreshold: 1 readinessProbe: - initialDelaySeconds: 30 + initialDelaySeconds: 5 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 6 @@ -238,40 +238,12 @@ metrics: enabled: false service: port: 24231 - annotations: - prometheus.io/scrape: "true" - prometheus.io/port: "24231" - prometheus.io/path: "/metrics" - -service: - type: ClusterIP - ## Fluentd TCP forward port - port: 24224 - ## Specify the nodePort value for the LoadBalancer and NodePort service types. - ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport - ## - # nodePort: - - ## Provide any additional annotations which may be required. This can be used to - ## set the LoadBalancer service type to internal only. - ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer - ## - annotations: {} - # loadBalancerIP: - -ingress: - enabled: false - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: chart-example.local - paths: [] - - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local + ## Annotations for the Prometheus metrics service + ## annotations: + ## prometheus.io/scrape: "true" + ## prometheus.io/port: "24231" + ## prometheus.io/path: "/metrics" + annotations: {} tls: enabled: false @@ -286,7 +258,3 @@ securityContext: enabled: true runAsUser: 1001 fsGroup: 1001 - runAsNonRoot: true - - - From ddf4a5e7c937a669f47b90e628dcde24d3915219 Mon Sep 17 00:00:00 2001 From: Alejandro Moreno Date: Fri, 27 Sep 2019 14:34:25 +0000 Subject: [PATCH 07/10] Address review suggestions and refactor --- bitnami/fluentd/README.md | 150 +++++++++--------- bitnami/fluentd/templates/NOTES.txt | 32 +--- bitnami/fluentd/templates/_helpers.tpl | 16 ++ .../templates/aggregator-configmap.yaml | 37 ++++- .../templates/aggregator-statefulset.yaml | 59 ++++--- bitnami/fluentd/templates/clusterrole.yaml | 3 +- .../fluentd/templates/clusterrolebinding.yaml | 3 +- bitnami/fluentd/templates/configmap.yaml | 8 - .../templates/forwarder-configmap.yaml | 128 +++++++-------- .../templates/forwarder-daemonset.yaml | 62 ++++---- bitnami/fluentd/templates/serviceaccount.yaml | 3 +- bitnami/fluentd/templates/svc-headless.yaml | 7 +- bitnami/fluentd/templates/svc.yaml | 38 ++--- bitnami/fluentd/values.yaml | 50 +++--- 14 files changed, 304 insertions(+), 292 deletions(-) delete mode 100644 bitnami/fluentd/templates/configmap.yaml diff --git a/bitnami/fluentd/README.md b/bitnami/fluentd/README.md index d5e3144d3..623195d29 100644 --- a/bitnami/fluentd/README.md +++ b/bitnami/fluentd/README.md @@ -30,7 +30,7 @@ These commands deploy Fluentd on the Kubernetes cluster in the default configura ## Uninstalling the Chart -To uninstall/delete the `my-release` statefulset: +To uninstall/delete the `my-release` resources: ```console $ helm delete my-release @@ -42,79 +42,81 @@ The command removes all the Kubernetes components associated with the chart and The following tables lists the configurable parameters of the kibana chart and their default values. -| Parameter | Description | Default | -| ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | -| `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}` | -| `image.pullPolicy` | Fluentd image pull policy | `IfNotPresent` | -| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | -| `nameOverride` | String to partially override fluentd.fullname template with a string (will prepend the release name) | `nil` | -| `fullnameOverride` | String to fully override fluentd.fullname template with a string | `nil` | -| `clusterDomain` | Kubernetes DNS domain name to use | `cluster.local` | -| `forwarder.configFile` | Name of the config file that will be used by Fluentd at launch under the `/opt/bitnami/fluentd/conf` directory | `fluentd.conf` | -| `forwarder.service.type` | Kubernetes Service type | | `ClusterIP` | -| `forwarder.service.port` | Kubernetes Service port - Fluentd transport port for the forwarders | `24224` | -| `forwarder.service.nodePort` | Port to bind to for NodePort service type (client port) | `nil` | -| `forwarder.service.annotations` | Annotations for Fluentd service (evaluated as a template) | `{}` | -| `forwarder.service.loadBalancerIP` | loadBalancerIP if Fluentd service type is `LoadBalancer` | `nil` | -| `forwarder.extraArgs` | Extra arguments for the Fluentd command line | `nil` | -| `forwarder.extraEnv` | Extra environment variables to pass to the container | `{}` | -| `forwarder.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `60` | -| `forwarder.livenessProbe.periodSeconds` | How often to perform the probe | `10` | -| `forwarder.livenessProbe.timeoutSeconds` | When the probe times out | `5` | -| `forwarder.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` | -| `forwarder.livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | -| `forwarder.readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `5` | -| `forwarder.readinessProbe.periodSeconds` | How often to perform the probe | `10` | -| `forwarder.readinessProbe.timeoutSeconds` | When the probe times out | `5` | -| `forwarder.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` | -| `forwarder.readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | -| `forwarder.updateStrategy` | Update strategy for the forwarder DaemonSet | `RollingUpdate` | -| `forwarder.resources` | Configure resource requests and limits | `nil` | -| `forwarder.nodeSelector` | Node labels for pod assignment | `{}` | -| `forwarder.tolerations` | Tolerations for pod assignment | `[]` | -| `forwarder.affinity` | Affinity for pod assignment | `{}` | -| `forwarder.podAnnotations` | Pod annotations | `{}` | -| `aggregator.replicaCount` | Number of aggregator pods to deploy in the Stateful Set | `2` | -| `aggregator.configFile` | Name of the config file that will be used by Fluentd at launch under the `/opt/bitnami/fluentd/conf` directory | `fluentd.conf` | -| `aggregator.service.type` | Kubernetes Service type | | `ClusterIP` | -| `aggregator.port` | Kubernetes Service port - Fluentd transport port for the aggregators | `24224` | -| `aggregator.extraArgs` | Extra arguments for the Fluentd command line | `nil` | -| `aggregator.extraEnv` | Extra environment variables to pass to the container | `{}` | -| `aggregator.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `60` | -| `aggregator.livenessProbe.periodSeconds` | How often to perform the probe | `10` | -| `aggregator.livenessProbe.timeoutSeconds` | When the probe times out | `5` | -| `aggregator.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` | -| `aggregator.livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | -| `aggregator.readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `5` | -| `aggregator.readinessProbe.periodSeconds` | How often to perform the probe | `10` | -| `aggregator.readinessProbe.timeoutSeconds` | When the probe times out | `5` | -| `aggregator.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` | -| `aggregator.readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | -| `aggregator.updateStrategy` | Update strategy for the aggregator DaemonSet | `RollingUpdate` | -| `aggregator.resources` | Configure resource requests and limits | `nil` | -| `aggregator.nodeSelector` | Node labels for pod assignment | `{}` | -| `aggregator.tolerations` | Tolerations for pod assignment | `[]` | -| `aggregator.affinity` | Affinity for pod assignment | `{}` | -| `aggregator.podAnnotations` | Pod annotations | `{}` | -| `serviceAccount.create` | Specify whether a ServiceAccount should be created | `true` | -| `serviceAccount.name` | The name of the ServiceAccount to create | Generated using the `fluentd.fullname` template | -| `rbac.create` | Specify whether RBAC resources should be created and used | `true` | -| `metrics.enabled` | Enable the export of Prometheus metrics | `nil` | -| `metrics.service.port` | Prometheus metrics service port | `24231` | -| `metrics.service.annotations` | Annotations for Prometheus metrics service | `{}` | -| `tls.enabled` | Enable the addition of TLS certificates | | `false` | -| `tls.caCertificate` | Ca certificate | Certificate Authority (CA) bundle content | -| `tls.serverCertificate` | Server certificate | Server certificate content | -| `tls.serverKey` | Server Key | Server private key content | -| `tls.existingSecret` | Existing secret with certificate content | `nil` | -| `securityContext.enabled` | Enable security context | `true` | -| `securityContext.fsGroup` | Group ID for the container filesystem | `1001` | -| `securityContext.runAsUser` | User ID for the container | `1001` | +| Parameter | Description | Default | +| ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | +| `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}` | +| `image.pullPolicy` | Fluentd image pull policy | `IfNotPresent` | +| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | +| `nameOverride` | String to partially override fluentd.fullname template with a string (will prepend the release name) | `nil` | +| `fullnameOverride` | String to fully override fluentd.fullname template with a string | `nil` | +| `clusterDomain` | Kubernetes DNS domain name to use | `cluster.local` | +| `forwarder.configFile` | Name of the config file that will be used by Fluentd at launch under the `/opt/bitnami/fluentd/conf` directory | `fluentd.conf` | +| `forwarder.configMap` | Name of the config map that contains the Fluentd configuration files | `nil` | +| `forwarder.extraArgs` | Extra arguments for the Fluentd command line | `nil` | +| `forwarder.extraEnv` | Extra environment variables to pass to the container | `{}` | +| `forwarder.livenessProbe.enabled` | Enable liveness probes for the forwarder | `true` | +| `forwarder.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `60` | +| `forwarder.livenessProbe.periodSeconds` | How often to perform the probe | `10` | +| `forwarder.livenessProbe.timeoutSeconds` | When the probe times out | `5` | +| `forwarder.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` | +| `forwarder.livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | +| `forwarder.readinessProbe.enabled` | Enable readiness probes for the forwarder | `true` | +| `forwarder.readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `5` | +| `forwarder.readinessProbe.periodSeconds` | How often to perform the probe | `10` | +| `forwarder.readinessProbe.timeoutSeconds` | When the probe times out | `5` | +| `forwarder.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` | +| `forwarder.readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | +| `forwarder.updateStrategy` | Update strategy for the forwarder DaemonSet | `RollingUpdate` | +| `forwarder.resources` | Configure resource requests and limits | `nil` | +| `forwarder.nodeSelector` | Node labels for pod assignment | `{}` | +| `forwarder.tolerations` | Tolerations for pod assignment | `[]` | +| `forwarder.affinity` | Affinity for pod assignment | `{}` | +| `forwarder.podAnnotations` | Pod annotations | `{}` | +| `aggregator.replicaCount` | Number of aggregator pods to deploy in the Stateful Set | `2` | +| `aggregator.configFile` | Name of the config file that will be used by Fluentd at launch under the `/opt/bitnami/fluentd/conf` directory | `fluentd.conf` | +| `aggregator.configMap` | Name of the config map that contains the Fluentd configuration files | `nil` | +| `aggregator.port` | Kubernetes Service port - Fluentd transport port for the aggregators | `24224` | +| `aggregator.extraArgs` | Extra arguments for the Fluentd command line | `nil` | +| `aggregator.extraEnv` | Extra environment variables to pass to the container | `{}` | +| `aggregator.livenessProbe.enabled` | Enable liveness probes for the aggregator | `true` | +| `aggregator.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `60` | +| `aggregator.livenessProbe.periodSeconds` | How often to perform the probe | `10` | +| `aggregator.livenessProbe.timeoutSeconds` | When the probe times out | `5` | +| `aggregator.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` | +| `aggregator.livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | +| `aggregator.readinessProbe.enabled` | Enable readiness probes for the aggregator | `true` | +| `aggregator.readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `5` | +| `aggregator.readinessProbe.periodSeconds` | How often to perform the probe | `10` | +| `aggregator.readinessProbe.timeoutSeconds` | When the probe times out | `5` | +| `aggregator.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` | +| `aggregator.readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | +| `aggregator.updateStrategy` | Update strategy for the aggregator DaemonSet | `RollingUpdate` | +| `aggregator.resources` | Configure resource requests and limits | `nil` | +| `aggregator.nodeSelector` | Node labels for pod assignment | `{}` | +| `aggregator.tolerations` | Tolerations for pod assignment | `[]` | +| `aggregator.affinity` | Affinity for pod assignment | `{}` | +| `aggregator.podAnnotations` | Pod annotations | `{}` | +| `serviceAccount.create` | Specify whether a ServiceAccount should be created | `true` | +| `serviceAccount.name` | The name of the ServiceAccount to create | Generated using the `fluentd.fullname` template | +| `rbac.create` | Specify whether RBAC resources should be created and used | `true` | +| `metrics.enabled` | Enable the export of Prometheus metrics | `nil` | +| `metrics.service.type` | Prometheus metrics service type | `ClusterIP` | +| `metrics.service.loadBalancerIP` | Load Balancer IP if the Prometheus metrics server type is `LoadBalancer` | `nil` | +| `metrics.service.port` | Prometheus metrics service port | `24231` | +| `metrics.service.annotations` | Annotations for Prometheus metrics service | `{ prometheus.io/scrape: "true", prometheus.io/port: "80", prometheus.io/path: "_prometheus/metrics" }` | +| `tls.enabled` | Enable the addition of TLS certificates | `false` | +| `tls.caCertificate` | Ca certificate | Certificate Authority (CA) bundle content | +| `tls.serverCertificate` | Server certificate | Server certificate content | +| `tls.serverKey` | Server Key | Server private key content | +| `tls.existingSecret` | Existing secret with certificate content | `nil` | +| `securityContext.enabled` | Enable security context | `true` | +| `securityContext.fsGroup` | Group ID for the container filesystem | `1001` | +| `securityContext.runAsUser` | User ID for the container | `1001` | Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, diff --git a/bitnami/fluentd/templates/NOTES.txt b/bitnami/fluentd/templates/NOTES.txt index fc5c33fa7..59bcdc5cf 100644 --- a/bitnami/fluentd/templates/NOTES.txt +++ b/bitnami/fluentd/templates/NOTES.txt @@ -1,30 +1,14 @@ ** Please be patient while the chart is being deployed ** - Fluentd can be accessed within the cluster on port {{ .Values.forwarder.service.port }} at {{ template "fluentd.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }} + To verify that Fluentd has started, run: - To access from outside the cluster execute the following commands: + kubectl get all -l "app.kubernetes.io/name={{ include "fluentd.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -{{- if contains "NodePort" .Values.forwarder.service.type }} + 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: - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fluentd.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - curl http://$NODE_IP:$NODE_PORT/ -{{- else if contains "LoadBalancer" .Values.forwarder.service.type }} + 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. - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "fluentd.fullname" . }}' - - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fluentd.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - curl http://$SERVICE_IP:{{ .Values.forwarder.service.port }}/ -{{- else if contains "ClusterIP" .Values.forwarder.service.type }} - - kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "fluentd.fullname" . }} {{ .Values.forwarder.service.port }}:24224 & - curl http://127.0.0.1:24224/ -{{- end }} - -{{- if and (contains "bitnami/" .Values.image.repository) (not (.Values.image.tag | toString | regexFind "-r\\d+$|sha256:")) }} - -WARNING: Rolling tag detected ({{ .Values.image.repository }}:{{ .Values.image.tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment. -+info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/ - -{{- end }} +{{ include "fluentd.checkRollingTags" . }} diff --git a/bitnami/fluentd/templates/_helpers.tpl b/bitnami/fluentd/templates/_helpers.tpl index ddb842ff2..ad9871c14 100644 --- a/bitnami/fluentd/templates/_helpers.tpl +++ b/bitnami/fluentd/templates/_helpers.tpl @@ -41,6 +41,14 @@ app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end -}} +{{/* +Labels to use on daemonset.spec.selector.matchLabels, statefulset.spec.selector.matchLabels and svc.spec.selector +*/}} +{{- define "fluentd.matchLabels" -}} +app.kubernetes.io/name: {{ include "fluentd.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + {{/* Return the proper Fluentd image name */}} @@ -138,3 +146,11 @@ Create the name of the service account to use {{ default "default" .Values.serviceAccount.name }} {{- end -}} {{- end -}} + +{{/* Check if there are rolling tags in the images */}} +{{- define "fluentd.checkRollingTags" -}} +{{- if and (contains "bitnami/" .Values.image.repository) (not (.Values.image.tag | toString | regexFind "-r\\d+$|sha256:")) }} +WARNING: Rolling tag detected ({{ .Values.image.repository }}:{{ .Values.image.tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment. ++info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/ +{{- end }} +{{- end -}} diff --git a/bitnami/fluentd/templates/aggregator-configmap.yaml b/bitnami/fluentd/templates/aggregator-configmap.yaml index 0df416e30..d68ed831d 100644 --- a/bitnami/fluentd/templates/aggregator-configmap.yaml +++ b/bitnami/fluentd/templates/aggregator-configmap.yaml @@ -1,32 +1,63 @@ +{{- if not .Values.aggregator.configMap -}} apiVersion: v1 kind: ConfigMap metadata: name: {{ include "fluentd.fullname" . }}-aggregator-cm labels: {{ include "fluentd.labels" . | nindent 4 }} + app.kubernetes.io/component: aggregator data: - aggregator.conf: | + fluentd.conf: | + {{- if .Values.metrics.enabled }} + # Prometheus Exporter Plugin + # input plugin that exports metrics + + @type prometheus + port {{ .Values.metrics.service.port }} + + + # input plugin that collects metrics from MonitorAgent + + @type prometheus_monitor + + host ${hostname} + + + + # input plugin that collects metrics for output plugin + + @type prometheus_output_monitor + + host ${hostname} + + + {{- end }} + + # Ignore fluentd own events @type null - # TCP input + # TCP input to receive logs from the forwarders @type forward bind 0.0.0.0 port {{ .Values.aggregator.port }} - # HTTP input + # HTTP input for the liveness and readiness probes @type http bind 0.0.0.0 port 9880 + # Throw the healthcheck to the standard output instead of forwarding it @type stdout + # Send the logs to the standard output @type stdout +{{- end -}} diff --git a/bitnami/fluentd/templates/aggregator-statefulset.yaml b/bitnami/fluentd/templates/aggregator-statefulset.yaml index 6a111d02c..29e4a33dd 100644 --- a/bitnami/fluentd/templates/aggregator-statefulset.yaml +++ b/bitnami/fluentd/templates/aggregator-statefulset.yaml @@ -2,24 +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: - app.kubernetes.io/name: {{ include "fluentd.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} + 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: - app.kubernetes.io/name: {{ include "fluentd.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} + labels: {{ include "fluentd.labels" . | nindent 8 }} app.kubernetes.io/component: aggregator annotations: checksum/config: {{ include (print $.Template.BasePath "/aggregator-configmap.yaml") . | sha256sum }} @@ -35,12 +29,12 @@ spec: runAsNonRoot: {{ .Values.securityContext.runAsNonRoot }} {{- end }} containers: - - name: {{ .Chart.Name }} + - name: fluentd image: {{ include "fluentd.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: FLUENTD_CONF - value: {{ default "fluentd.conf" .Values.aggregator.configFile }} + value: {{ .Values.aggregator.configFile }} - name: FLUENTD_OPT value: {{ .Values.aggregator.extraArgs }} {{- if .Values.aggregator.extraEnv }} @@ -53,19 +47,37 @@ spec: - 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: 9880 - initialDelaySeconds: 5 - timeoutSeconds: 1 + 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-file - mountPath: /opt/bitnami/fluentd/conf/fluentd.conf - subPath: fluentd.conf - - name: fluentd-extra-config - mountPath: /opt/bitnami/fluentd/conf/conf.d + - name: fluentd-config + mountPath: /opt/bitnami/fluentd/conf - name: buffer mountPath: /opt/bitnami/fluentd/logs/buffers {{- if .Values.tls.enabled }} @@ -85,12 +97,9 @@ spec: - key: server_key.pem path: server_key.pem {{- end }} - - name: fluentd-config-file + - name: fluentd-config configMap: - name: {{ include "fluentd.fullname" . }}-cm - - name: fluentd-extra-config - configMap: - name: {{ include "fluentd.fullname" . }}-aggregator-cm + name: {{ if .Values.aggregator.configMap }}{{ .Values.aggregator.configMap }}{{- else }}{{ include "fluentd.fullname" . }}-aggregator-cm{{- end }} - name: buffer emptyDir: {} {{- with .Values.aggregator.nodeSelector }} diff --git a/bitnami/fluentd/templates/clusterrole.yaml b/bitnami/fluentd/templates/clusterrole.yaml index 6d6368906..c0e862e5d 100644 --- a/bitnami/fluentd/templates/clusterrole.yaml +++ b/bitnami/fluentd/templates/clusterrole.yaml @@ -3,8 +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: - "" diff --git a/bitnami/fluentd/templates/clusterrolebinding.yaml b/bitnami/fluentd/templates/clusterrolebinding.yaml index 8e4662983..2b62f14c7 100644 --- a/bitnami/fluentd/templates/clusterrolebinding.yaml +++ b/bitnami/fluentd/templates/clusterrolebinding.yaml @@ -3,8 +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 diff --git a/bitnami/fluentd/templates/configmap.yaml b/bitnami/fluentd/templates/configmap.yaml deleted file mode 100644 index 0030d95a3..000000000 --- a/bitnami/fluentd/templates/configmap.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "fluentd.fullname" . }}-cm - labels: {{ include "fluentd.labels" . | nindent 4 }} -data: - fluentd.conf: | - @include conf.d/*.conf diff --git a/bitnami/fluentd/templates/forwarder-configmap.yaml b/bitnami/fluentd/templates/forwarder-configmap.yaml index 240dc1b19..50a64e362 100644 --- a/bitnami/fluentd/templates/forwarder-configmap.yaml +++ b/bitnami/fluentd/templates/forwarder-configmap.yaml @@ -1,72 +1,13 @@ +{{- if not .Values.forwarder.configMap -}} apiVersion: v1 kind: ConfigMap metadata: name: {{ include "fluentd.fullname" . }}-forwarder-cm labels: {{ include "fluentd.labels" . | nindent 4 }} + app.kubernetes.io/component: forwarder data: - forwarder.conf: | - - @type null - - - # TCP input - - @type forward - port {{ .Values.forwarder.service.port }} - - - # HTTP input - - @type http - port 9880 - - - - @type tail - path /var/log/containers/*.log - # exclude Fluentd logs - exclude_path /var/log/containers/{{ include "fluentd.fullname" . }}*.log - pos_file /opt/bitnami/fluentd/logs/buffers/fluentd-docker.pos - tag kubernetes.* - read_from_head true - - @type regexp - expression /^(? - - - - @type stdout - - - - @type kubernetes_metadata - - - # Log Forwarding - - @type forward - {{- $fullName := (include "fluentd.fullname" .) }} - {{- $global := . }} - {{- $domain := default "cluster.local" .Values.clusterDomain }} - {{- $port := .Values.aggregator.port | int }} - {{- range $i, $e := until (.Values.aggregator.replicaCount | int) }} - - {{ printf "host %s-%d.%s-headless.%s.svc.%s" $fullName $i $fullName $global.Release.Namespace $domain }} - {{ printf "port %d" $port }} - {{- if ne $i 0 }} - standby - {{- end }} - - {{- end}} - - - flush_interval 10s - - - {{- if .Values.metrics.enabled }} - metrics.conf: | + fluentd.conf: | + {{- if .Values.metrics.enabled }} # Prometheus Exporter Plugin # input plugin that exports metrics @@ -97,4 +38,63 @@ data: host ${hostname} - {{- end }} + {{- end }} + + # Ignore fluentd own events + + @type null + + + # HTTP input for the liveness and readiness probes + + @type http + port 9880 + + + # Throw the healthcheck to the standard output instead of forwarding it + + @type stdout + + + # Get the logs from the containers running in the node + + @type tail + path /var/log/containers/*.log + # exclude Fluentd logs + exclude_path /var/log/containers/{{ include "fluentd.fullname" . }}*.log + pos_file /opt/bitnami/fluentd/logs/buffers/fluentd-docker.pos + tag kubernetes.* + read_from_head true + + @type regexp + expression /^(? + + + + @type kubernetes_metadata + + + # Forward all logs to the aggregators + + @type forward + {{- $fullName := (include "fluentd.fullname" .) }} + {{- $global := . }} + {{- $domain := default "cluster.local" .Values.clusterDomain }} + {{- $port := .Values.aggregator.port | int }} + {{- range $i, $e := until (.Values.aggregator.replicaCount | int) }} + + {{ printf "host %s-%d.%s-headless.%s.svc.%s" $fullName $i $fullName $global.Release.Namespace $domain }} + {{ printf "port %d" $port }} + {{- if ne $i 0 }} + standby + {{- end }} + + {{- end}} + + + flush_interval 10s + + +{{- end -}} diff --git a/bitnami/fluentd/templates/forwarder-daemonset.yaml b/bitnami/fluentd/templates/forwarder-daemonset.yaml index 92f36a2ec..039904bbe 100644 --- a/bitnami/fluentd/templates/forwarder-daemonset.yaml +++ b/bitnami/fluentd/templates/forwarder-daemonset.yaml @@ -2,22 +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: - app.kubernetes.io/name: {{ include "fluentd.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} + 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: - app.kubernetes.io/name: {{ include "fluentd.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} + labels: {{ include "fluentd.labels" . | nindent 8 }} app.kubernetes.io/component: forwarder annotations: checksum/config: {{ include (print $.Template.BasePath "/forwarder-configmap.yaml") . | sha256sum }} @@ -34,21 +28,18 @@ spec: runAsNonRoot: {{ .Values.securityContext.runAsNonRoot }} {{- end }} containers: - - name: {{ .Chart.Name }} + - name: fluentd image: {{ include "fluentd.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: FLUENTD_CONF - value: {{ default "fluentd.conf" .Values.forwarder.configFile }} + value: {{ .Values.forwarder.configFile }} - name: FLUENTD_OPT value: {{ .Values.forwarder.extraArgs }} {{- if .Values.forwarder.extraEnv }} {{- toYaml .Values.forwarder.extraEnv | nindent 12 }} {{- end }} ports: - - name: tcp - containerPort: {{ .Values.forwarder.service.port }} - protocol: TCP - name: http containerPort: 9880 protocol: TCP @@ -57,19 +48,32 @@ spec: 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: 9880 - initialDelaySeconds: 5 - timeoutSeconds: 1 + 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-file - mountPath: /opt/bitnami/fluentd/conf/fluentd.conf - subPath: fluentd.conf - - name: fluentd-extra-config - mountPath: /opt/bitnami/fluentd/conf/conf.d + - name: fluentd-config + mountPath: /opt/bitnami/fluentd/conf - name: buffer mountPath: /opt/bitnami/fluentd/logs/buffers {{- if .Values.tls.enabled }} @@ -78,6 +82,8 @@ spec: {{- end }} - name: varlog mountPath: /var/log + - name: varlibdockercontainers + mountPath: /var/lib/docker/containers volumes: {{- if .Values.tls.enabled }} - name: {{ template "fluentd.fullname" . }}-certs @@ -91,17 +97,17 @@ spec: - key: server_key.pem path: server_key.pem {{- end }} - - name: fluentd-config-file + - name: fluentd-config configMap: - name: {{ include "fluentd.fullname" . }}-cm - - name: fluentd-extra-config - configMap: - name: {{ include "fluentd.fullname" . }}-forwarder-cm + name: {{ if .Values.forwarder.configMap }}{{ .Values.forwarder.configMap }}{{- else }}{{ include "fluentd.fullname" . }}-forwarder-cm{{- end }} - 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 }} diff --git a/bitnami/fluentd/templates/serviceaccount.yaml b/bitnami/fluentd/templates/serviceaccount.yaml index d5f4ea151..71973bc3d 100644 --- a/bitnami/fluentd/templates/serviceaccount.yaml +++ b/bitnami/fluentd/templates/serviceaccount.yaml @@ -3,6 +3,5 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ include "fluentd.serviceAccountName" . }} - labels: - {{- include "fluentd.labels" . | nindent 4 }} + labels: {{ include "fluentd.labels" . | nindent 4 }} {{- end -}} \ No newline at end of file diff --git a/bitnami/fluentd/templates/svc-headless.yaml b/bitnami/fluentd/templates/svc-headless.yaml index eace46edb..21fb65352 100644 --- a/bitnami/fluentd/templates/svc-headless.yaml +++ b/bitnami/fluentd/templates/svc-headless.yaml @@ -2,8 +2,7 @@ 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 @@ -12,7 +11,5 @@ spec: - name: tcp port: {{ .Values.aggregator.port }} targetPort: tcp - selector: - app.kubernetes.io/name: {{ include "fluentd.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} + selector: {{ include "fluentd.matchLabels" . | nindent 4 }} app.kubernetes.io/component: aggregator \ No newline at end of file diff --git a/bitnami/fluentd/templates/svc.yaml b/bitnami/fluentd/templates/svc.yaml index 7c4992aba..96d79ac7d 100644 --- a/bitnami/fluentd/templates/svc.yaml +++ b/bitnami/fluentd/templates/svc.yaml @@ -1,38 +1,18 @@ +{{- if .Values.metrics.enabled }} apiVersion: v1 kind: Service metadata: name: {{ include "fluentd.fullname" . }} - labels: - {{- include "fluentd.labels" . | nindent 4 }} - app.kubernetes.io/component: forwarder -{{- if or (and .Values.metrics.enabled .Values.metrics.service.annotations) .Values.forwarder.service.annotations }} - annotations: - {{- if and .Values.metrics.enabled .Values.metrics.service.annotations }} - {{- tpl (toYaml .Values.metrics.service.annotations) $ | nindent 4 }} - {{- end }} - {{- if and .Values.forwarder.service.annotations }} - {{- tpl (toYaml .Values.forwarder.service.annotations) $ | nindent 4 }} - {{- end }} -{{- end }} + labels: {{ include "fluentd.labels" . | nindent 4 }} + annotations: {{ tpl (toYaml .Values.metrics.service.annotations) $ | nindent 4 }} spec: - type: {{ .Values.forwarder.service.type }} - {{- if eq .Values.forwarder.service.type "LoadBalancer" }} {{- if .Values.forwarder.service.loadBalancerIP }} - loadBalancerIP: {{ .Values.forwarder.service.loadBalancerIP }} - {{- end }} {{- end }} - type: {{ .Values.forwarder.service.type }} + type: {{ .Values.metrics.service.type }} + {{- if and (eq .Values.metrics.service.type "LoadBalancer") .Values.metrics.service.loadBalancerIP }} + loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }} + {{- end }} ports: - - name: tcp - targetPort: tcp - port: {{ .Values.forwarder.service.port }} - {{- if .Values.forwarder.service.nodePort }} - nodePort: {{ .Values.forwarder.service.nodePort }} - {{- end }} - {{- if .Values.metrics.enabled }} - name: metrics port: {{ .Values.metrics.service.port }} targetPort: metrics - {{- end }} - selector: - app.kubernetes.io/name: {{ include "fluentd.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/component: forwarder + selector: {{ include "fluentd.matchLabels" . | nindent 4 }} +{{- end }} diff --git a/bitnami/fluentd/values.yaml b/bitnami/fluentd/values.yaml index fd6fa48b7..3b49aff09 100644 --- a/bitnami/fluentd/values.yaml +++ b/bitnami/fluentd/values.yaml @@ -14,7 +14,7 @@ image: registry: docker.io repository: bitnami/fluentd - tag: 1.7.2-debian-9-r3 + tag: 1.7.2-debian-9-r8 ## Specify a imagePullPolicy ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images @@ -42,25 +42,11 @@ forwarder: ## Name of the config file that will be used by Fluentd at launch ## Fluentd will look for it under the /opt/bitnami/fluentd/conf directory ## - # configFile: fluentd.conf - - ## Service configuration - ## - service: - type: ClusterIP - ## Fluentd TCP forward port - port: 24224 - ## Specify the nodePort value for the LoadBalancer and NodePort service types. - ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport - ## - # nodePort: - ## - ## Provide any additional annotations which may be required. This can be used to - ## set the LoadBalancer service type to internal only. - ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer - ## - annotations: {} - # loadBalancerIP: + configFile: fluentd.conf + + ## Name of the configMap that contains the configuration files for fluentd + ## If not specified, one will be created by default + # configMap: ## String with extra arguments for the Fluentd command line ## ref: https://docs.fluentd.org/deployment/command-line-option @@ -78,12 +64,14 @@ forwarder: ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes) ## livenessProbe: + enabled: true initialDelaySeconds: 60 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 6 successThreshold: 1 readinessProbe: + enabled: true initialDelaySeconds: 5 periodSeconds: 10 timeoutSeconds: 5 @@ -139,7 +127,11 @@ aggregator: ## Name of the config file that will be used by Fluentd at launch ## Fluentd will look for it under the /opt/bitnami/fluentd/conf directory ## - # configFile: fluentd.conf + configFile: fluentd.conf + + ## Name of the configMap that contains the configuration files for fluentd + ## If not specified, one will be created by default + # configMap: ## Port which the forwarders will connect to to send the logs ## @@ -161,12 +153,14 @@ aggregator: ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes) ## livenessProbe: + enabled: true initialDelaySeconds: 60 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 6 successThreshold: 1 readinessProbe: + enabled: true initialDelaySeconds: 5 periodSeconds: 10 timeoutSeconds: 5 @@ -237,14 +231,18 @@ rbac: metrics: enabled: false service: + type: ClusterIP + # loadBalancerIP: port: 24231 ## Annotations for the Prometheus metrics service - ## annotations: - ## prometheus.io/scrape: "true" - ## prometheus.io/port: "24231" - ## prometheus.io/path: "/metrics" - annotations: {} + ## + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "24231" + prometheus.io/path: "/metrics" +## Mount TLS certificates +## tls: enabled: false caCertificate: |- From d87ca34cdd7fd4fcee4e8275e50e0fe47b2e3667 Mon Sep 17 00:00:00 2001 From: Alejandro Moreno Date: Fri, 27 Sep 2019 16:33:45 +0000 Subject: [PATCH 08/10] Address review suggestions and add Elasticsearch example --- bitnami/fluentd/README.md | 96 +++++++++- bitnami/fluentd/templates/NOTES.txt | 5 +- bitnami/fluentd/templates/_helpers.tpl | 105 ++++++----- .../templates/aggregator-configmap.yaml | 6 +- .../templates/aggregator-statefulset.yaml | 158 ++++++++-------- bitnami/fluentd/templates/certs.yaml | 2 +- bitnami/fluentd/templates/clusterrole.yaml | 2 +- .../fluentd/templates/clusterrolebinding.yaml | 2 +- .../templates/forwarder-configmap.yaml | 14 +- .../templates/forwarder-daemonset.yaml | 168 +++++++++--------- bitnami/fluentd/templates/serviceaccount.yaml | 2 +- bitnami/fluentd/templates/svc-headless.yaml | 10 +- bitnami/fluentd/templates/svc.yaml | 6 +- bitnami/fluentd/values.yaml | 15 +- 14 files changed, 345 insertions(+), 246 deletions(-) diff --git a/bitnami/fluentd/README.md b/bitnami/fluentd/README.md index 623195d29..84d83a882 100644 --- a/bitnami/fluentd/README.md +++ b/bitnami/fluentd/README.md @@ -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 + + @type prometheus + port {{ .Values.metrics.service.port }} + + + # input plugin that collects metrics from MonitorAgent + + @type prometheus_monitor + + host ${hostname} + + + + # input plugin that collects metrics for output plugin + + @type prometheus_output_monitor + + host ${hostname} + + + {{- end }} + + # Ignore fluentd own events + + @type null + + + # TCP input to receive logs from the forwarders + + @type forward + bind 0.0.0.0 + port {{ .Values.aggregator.port }} + + + # HTTP input for the liveness and readiness probes + + @type http + bind 0.0.0.0 + port 9880 + + + # Throw the healthcheck to the standard output instead of forwarding it + + @type stdout + + + # Send the logs to the standard output + + @type elasticsearch + include_tag_key true + host "#{ENV['ELASTICSEARCH_HOST']}" + port "#{ENV['ELASTICSEARCH_PORT']}" + logstash_format true + + + @type file + path /opt/bitnami/fluentd/logs/buffers/logs.buffer + flush_thread_count 2 + flush_interval 5s + + +``` + +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. diff --git a/bitnami/fluentd/templates/NOTES.txt b/bitnami/fluentd/templates/NOTES.txt index 59bcdc5cf..9597ad625 100644 --- a/bitnami/fluentd/templates/NOTES.txt +++ b/bitnami/fluentd/templates/NOTES.txt @@ -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" . -}} diff --git a/bitnami/fluentd/templates/_helpers.tpl b/bitnami/fluentd/templates/_helpers.tpl index ad9871c14..479bc22ae 100644 --- a/bitnami/fluentd/templates/_helpers.tpl +++ b/bitnami/fluentd/templates/_helpers.tpl @@ -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 -}} diff --git a/bitnami/fluentd/templates/aggregator-configmap.yaml b/bitnami/fluentd/templates/aggregator-configmap.yaml index d68ed831d..90c5a046c 100644 --- a/bitnami/fluentd/templates/aggregator-configmap.yaml +++ b/bitnami/fluentd/templates/aggregator-configmap.yaml @@ -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 @@ -31,7 +31,7 @@ data: {{- end }} - + # Ignore fluentd own events @type null diff --git a/bitnami/fluentd/templates/aggregator-statefulset.yaml b/bitnami/fluentd/templates/aggregator-statefulset.yaml index 29e4a33dd..d28a090a5 100644 --- a/bitnami/fluentd/templates/aggregator-statefulset.yaml +++ b/bitnami/fluentd/templates/aggregator-statefulset.yaml @@ -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 }} diff --git a/bitnami/fluentd/templates/certs.yaml b/bitnami/fluentd/templates/certs.yaml index 3fb1bba8b..bd08ae891 100644 --- a/bitnami/fluentd/templates/certs.yaml +++ b/bitnami/fluentd/templates/certs.yaml @@ -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: diff --git a/bitnami/fluentd/templates/clusterrole.yaml b/bitnami/fluentd/templates/clusterrole.yaml index c0e862e5d..ea40a248d 100644 --- a/bitnami/fluentd/templates/clusterrole.yaml +++ b/bitnami/fluentd/templates/clusterrole.yaml @@ -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: - "" diff --git a/bitnami/fluentd/templates/clusterrolebinding.yaml b/bitnami/fluentd/templates/clusterrolebinding.yaml index 2b62f14c7..8a02c78c0 100644 --- a/bitnami/fluentd/templates/clusterrolebinding.yaml +++ b/bitnami/fluentd/templates/clusterrolebinding.yaml @@ -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 diff --git a/bitnami/fluentd/templates/forwarder-configmap.yaml b/bitnami/fluentd/templates/forwarder-configmap.yaml index 50a64e362..b36878272 100644 --- a/bitnami/fluentd/templates/forwarder-configmap.yaml +++ b/bitnami/fluentd/templates/forwarder-configmap.yaml @@ -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 @@ -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 - + + # enrich with kubernetes metadata @type kubernetes_metadata @@ -94,7 +95,10 @@ data: {{- end}} - flush_interval 10s + @type file + path /opt/bitnami/fluentd/logs/buffers/logs.buffer + flush_thread_count 2 + flush_interval 5s {{- end -}} diff --git a/bitnami/fluentd/templates/forwarder-daemonset.yaml b/bitnami/fluentd/templates/forwarder-daemonset.yaml index 039904bbe..5c4d5c722 100644 --- a/bitnami/fluentd/templates/forwarder-daemonset.yaml +++ b/bitnami/fluentd/templates/forwarder-daemonset.yaml @@ -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 }} diff --git a/bitnami/fluentd/templates/serviceaccount.yaml b/bitnami/fluentd/templates/serviceaccount.yaml index 71973bc3d..1e5847591 100644 --- a/bitnami/fluentd/templates/serviceaccount.yaml +++ b/bitnami/fluentd/templates/serviceaccount.yaml @@ -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 -}} \ No newline at end of file diff --git a/bitnami/fluentd/templates/svc-headless.yaml b/bitnami/fluentd/templates/svc-headless.yaml index 21fb65352..a48cebc9a 100644 --- a/bitnami/fluentd/templates/svc-headless.yaml +++ b/bitnami/fluentd/templates/svc-headless.yaml @@ -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 \ No newline at end of file diff --git a/bitnami/fluentd/templates/svc.yaml b/bitnami/fluentd/templates/svc.yaml index 96d79ac7d..8243ab7aa 100644 --- a/bitnami/fluentd/templates/svc.yaml +++ b/bitnami/fluentd/templates/svc.yaml @@ -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 }} diff --git a/bitnami/fluentd/values.yaml b/bitnami/fluentd/values.yaml index 3b49aff09..f4d17ba3f 100644 --- a/bitnami/fluentd/values.yaml +++ b/bitnami/fluentd/values.yaml @@ -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 ## From 83ad4ad8664d6a975beca04ed90800a4efd3a40c Mon Sep 17 00:00:00 2001 From: Alejandro Moreno Date: Tue, 1 Oct 2019 13:58:20 +0000 Subject: [PATCH 09/10] Production and horizontal scaling --- bitnami/fluentd/README.md | 32 ++- bitnami/fluentd/templates/_helpers.tpl | 2 +- .../templates/aggregator-statefulset.yaml | 14 +- bitnami/fluentd/templates/certs.yaml | 15 - .../templates/forwarder-daemonset.yaml | 14 +- bitnami/fluentd/templates/tls-certs.yaml | 13 + bitnami/fluentd/values-production.yaml | 256 ++++++++++++++++++ bitnami/fluentd/values.yaml | 7 +- 8 files changed, 316 insertions(+), 37 deletions(-) delete mode 100644 bitnami/fluentd/templates/certs.yaml create mode 100644 bitnami/fluentd/templates/tls-certs.yaml create mode 100644 bitnami/fluentd/values-production.yaml diff --git a/bitnami/fluentd/README.md b/bitnami/fluentd/README.md index 84d83a882..1eee02417 100644 --- a/bitnami/fluentd/README.md +++ b/bitnami/fluentd/README.md @@ -229,7 +229,37 @@ $ helm install bitnami/fluentd \ --set aggregator.extraEnv[1].value=your-port-here \ ``` -## [Rolling VS Immutable tags](https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/) +### Production configuration and horizontal scaling + +This chart includes a `values-production.yaml` file where you can find some parameters oriented to production configuration in comparison to the regular `values.yaml`. + +```console +$ helm install --name my-release -f ./values-production.yaml bitnami/fluentd +``` + +- Number of aggregator nodes: +```diff +- statefulset.replicaCount: 1 ++ statefulset.replicaCount: 2 +``` + +- Enable prometheus to access fluentd metrics endpoint: +```diff +- metrics.enabled: false ++ metrics.enabled: true +``` + +To horizontally scale this chart once it has been deployed: + +```console +$ helm upgrade my-release bitnami/fluentd \ + -f ./values-production.yaml \ + --set statefulset.replicaCount=3 +``` + +> **Note**: Scaling the statefulset with `kubectl scale ...` command is discouraged. Use `helm upgrade ...` for horizontal scaling to ensure the forwarders configuration is refreshed and aware of the new pods. + +### [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. diff --git a/bitnami/fluentd/templates/_helpers.tpl b/bitnami/fluentd/templates/_helpers.tpl index 479bc22ae..ce48d30f4 100644 --- a/bitnami/fluentd/templates/_helpers.tpl +++ b/bitnami/fluentd/templates/_helpers.tpl @@ -160,6 +160,6 @@ Get the certificates secret name. {{- if .Values.tls.existingSecret -}} {{- printf "%s" (tpl .Values.tls.existingSecret $) -}} {{- else -}} - {{- printf "%s-certs" (include "fluentd.fullname" . ) -}} + {{- printf "%s-tls" (include "fluentd.fullname" . ) -}} {{- end -}} {{- end -}} diff --git a/bitnami/fluentd/templates/aggregator-statefulset.yaml b/bitnami/fluentd/templates/aggregator-statefulset.yaml index d28a090a5..40f33fdbb 100644 --- a/bitnami/fluentd/templates/aggregator-statefulset.yaml +++ b/bitnami/fluentd/templates/aggregator-statefulset.yaml @@ -80,21 +80,19 @@ spec: - name: buffer mountPath: /opt/bitnami/fluentd/logs/buffers {{- if .Values.tls.enabled }} - - name: {{ template "fluentd.fullname" . }}-certs + - name: certs mountPath: /opt/bitnami/fluentd/certs {{- end }} volumes: {{- if .Values.tls.enabled }} - - name: {{ template "fluentd.fullname" . }}-certs + - name: 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 + - key: tls.crt + path: tls.crt + - key: tls.key + path: tls.key {{- end }} - name: fluentd-config configMap: diff --git a/bitnami/fluentd/templates/certs.yaml b/bitnami/fluentd/templates/certs.yaml deleted file mode 100644 index bd08ae891..000000000 --- a/bitnami/fluentd/templates/certs.yaml +++ /dev/null @@ -1,15 +0,0 @@ -{{- if and (not .Values.tls.existingSecret) ( .Values.tls.enabled) }} -apiVersion: v1 -kind: Secret -metadata: - name: {{ include "fluentd.fullname" . }}-certs - labels: {{- include "fluentd.labels" . | nindent 4 }} -type: Opaque -data: - ca_certificate.pem: - {{ required "A valid .Values.tls.caCertificate entry required!" .Values.tls.caCertificate | b64enc | quote }} - server_certificate.pem: - {{ required "A valid .Values.tls.serverCertificate entry required!" .Values.tls.serverCertificate| b64enc | quote }} - server_key.pem: - {{ required "A valid .Values.tls.serverKey entry required!" .Values.tls.serverKey | b64enc | quote }} -{{- end }} diff --git a/bitnami/fluentd/templates/forwarder-daemonset.yaml b/bitnami/fluentd/templates/forwarder-daemonset.yaml index 5c4d5c722..48e2f9bb0 100644 --- a/bitnami/fluentd/templates/forwarder-daemonset.yaml +++ b/bitnami/fluentd/templates/forwarder-daemonset.yaml @@ -76,7 +76,7 @@ spec: - name: buffer mountPath: /opt/bitnami/fluentd/logs/buffers {{- if .Values.tls.enabled }} - - name: {{ template "fluentd.fullname" . }}-certs + - name: certs mountPath: /opt/bitnami/fluentd/certs {{- end }} - name: varlog @@ -85,16 +85,14 @@ spec: mountPath: /var/lib/docker/containers volumes: {{- if .Values.tls.enabled }} - - name: {{ template "fluentd.fullname" . }}-certs + - name: 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 + - key: tls.crt + path: tls.crt + - key: tls.key + path: tls.key {{- end }} - name: fluentd-config configMap: diff --git a/bitnami/fluentd/templates/tls-certs.yaml b/bitnami/fluentd/templates/tls-certs.yaml new file mode 100644 index 000000000..f3db2d641 --- /dev/null +++ b/bitnami/fluentd/templates/tls-certs.yaml @@ -0,0 +1,13 @@ +{{- if and (not .Values.tls.existingSecret) ( .Values.tls.enabled) }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "fluentd.fullname" . }}-tls + labels: {{- include "fluentd.labels" . | nindent 4 }} +type: kubernetes.io/tls +data: + tls.crt: + {{ required "A valid .Values.tls.certificate entry required!" .Values.tls.certificate | b64enc }} + tls.key: + {{ required "A valid .Values.tls.key entry required!" .Values.tls.key | b64enc }} +{{- end }} diff --git a/bitnami/fluentd/values-production.yaml b/bitnami/fluentd/values-production.yaml new file mode 100644 index 000000000..7a62b4333 --- /dev/null +++ b/bitnami/fluentd/values-production.yaml @@ -0,0 +1,256 @@ +## 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 and imagePullSecrets +## +global: {} +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName + +## Bitnami Fluentd image version +## ref: https://hub.docker.com/r/bitnami/fluentd/tags/ +## +image: + registry: docker.io + repository: bitnami/fluentd + tag: 1.7.2-debian-9-r8 + ## Specify a imagePullPolicy + ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' + ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images + ## + pullPolicy: IfNotPresent + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName + +## String to partially override fluentd.fullname template (will maintain the release name) +## +# nameOverride: + +## String to fully override fluentd.fullname template +## +# fullnameOverride: + +## Cluster Domain +clusterDomain: cluster.local + +forwarder: + ## Name of the config file that will be used by Fluentd at launch + ## Fluentd will look for it under the /opt/bitnami/fluentd/conf directory + ## + configFile: fluentd.conf + + ## Name of the configMap that contains the configuration files for fluentd + ## If not specified, one will be created by default + # configMap: + + ## String with extra arguments for the Fluentd command line + ## ref: https://docs.fluentd.org/deployment/command-line-option + ## + extraArgs: "" + + ## Extra environment variables to pass to the container + ## extraEnv: + ## - name: MY_ENV_VAR + ## value: my_value + ## + extraEnv: {} + + ## Configure extra options for liveness and readiness probes + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes) + ## + livenessProbe: + enabled: true + initialDelaySeconds: 60 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + readinessProbe: + enabled: true + initialDelaySeconds: 5 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + + ## Set up update strategy. + ## ref: https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/#daemonset-update-strategy + ## Example: + # updateStrategy: + # type: RollingUpdate + # rollingUpdate: + # maxSurge: 25% + # maxUnavailable: 25% + updateStrategy: + type: RollingUpdate + + ## Configure resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## Example: + ## resources: + ## requests: + ## memory: 512Mi + ## cpu: 300m + ## + # resources: + + ## Node labels for pod assignment + ## Ref: https://kubernetes.io/docs/user-guide/node-selection/ + ## + nodeSelector: {} + + ## Tolerations for pod assignment + ## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + ## + tolerations: [] + + ## Affinity for pod assignment + ## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity + ## + affinity: {} + + ## Pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: {} + +aggregator: + ## Number of aggregator replicas + ## + replicaCount: 2 + + ## Name of the config file that will be used by Fluentd at launch + ## Fluentd will look for it under the /opt/bitnami/fluentd/conf directory + ## + configFile: fluentd.conf + + ## Name of the configMap that contains the configuration files for fluentd + ## If not specified, one will be created by default + # configMap: + + ## Port which the forwarders will connect to to send the logs + ## + port: 24224 + + ## String with extra arguments for the Fluentd command line + ## ref: https://docs.fluentd.org/deployment/command-line-option + ## + extraArgs: "" + + ## Extra environment variables to pass to the container + ## extraEnv: + ## - name: MY_ENV_VAR + ## - value: my_value + ## + extraEnv: {} + + ## Configure extra options for liveness and readiness probes + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes) + ## + livenessProbe: + enabled: true + initialDelaySeconds: 60 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + readinessProbe: + enabled: true + initialDelaySeconds: 5 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + + ## Set up update strategy. + ## ref: https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#updating-statefulsets + ## Example: + # updateStrategy: + # type: RollingUpdate + # rollingUpdate: + # maxSurge: 25% + # maxUnavailable: 25% + updateStrategy: + type: RollingUpdate + + ## Configure resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## Example: + ## resources: + ## requests: + ## memory: 512Mi + ## cpu: 300m + ## + # resources: + + ## Node labels for pod assignment + ## Ref: https://kubernetes.io/docs/user-guide/node-selection/ + ## + nodeSelector: {} + + ## Tolerations for pod assignment + ## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ + ## + tolerations: [] + + ## Affinity for pod assignment + ## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity + ## + affinity: {} + + ## Pod annotations + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## + podAnnotations: {} + +## Pods Service Account +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ +## +serviceAccount: + ## Specifies whether a ServiceAccount should be created + ## + create: true + ## The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fluentd.fullname template + # name: + +## Role Based Access +## ref: https://kubernetes.io/docs/admin/authorization/rbac/ +## +rbac: + create: true + +## Prometheus metrics +## ref: https://github.com/fluent/fluent-plugin-prometheus/blob/master/README.md +## +metrics: + enabled: true + service: + type: ClusterIP + # loadBalancerIP: + port: 24231 + ## Annotations for the Prometheus metrics service + ## + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "24231" + prometheus.io/path: "/metrics" + +## Mount TLS certificates +## +tls: + enabled: false + certificate: |- + key: |- + # existingSecret: name-of-existing-secret-to-certificates + +## SecurityContext configuration +## +securityContext: + enabled: true + runAsUser: 1001 + fsGroup: 1001 diff --git a/bitnami/fluentd/values.yaml b/bitnami/fluentd/values.yaml index f4d17ba3f..2b05379da 100644 --- a/bitnami/fluentd/values.yaml +++ b/bitnami/fluentd/values.yaml @@ -121,7 +121,7 @@ forwarder: aggregator: ## Number of aggregator replicas ## - replicaCount: 2 + replicaCount: 1 ## Name of the config file that will be used by Fluentd at launch ## Fluentd will look for it under the /opt/bitnami/fluentd/conf directory @@ -244,9 +244,8 @@ metrics: ## tls: enabled: false - caCertificate: |- - serverCertificate: |- - serverKey: |- + certificate: |- + key: |- # existingSecret: name-of-existing-secret-to-certificates ## SecurityContext configuration From 7f1c9c6714f38cfdfc00cfadb34cd94371510680 Mon Sep 17 00:00:00 2001 From: Bitnami Containers Date: Thu, 3 Oct 2019 17:13:14 +0000 Subject: [PATCH 10/10] [bitnami/fluentd] Update components versions Signed-off-by: Bitnami Containers --- bitnami/fluentd/Chart.yaml | 2 +- bitnami/fluentd/values-production.yaml | 2 +- bitnami/fluentd/values.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bitnami/fluentd/Chart.yaml b/bitnami/fluentd/Chart.yaml index 532e37741..c52e378ec 100644 --- a/bitnami/fluentd/Chart.yaml +++ b/bitnami/fluentd/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 name: fluentd version: 0.1.0 -appVersion: 1.7.2 +appVersion: 1.7.3 description: Fluentd is an open source data collector for unified logging layer keywords: - fluentd diff --git a/bitnami/fluentd/values-production.yaml b/bitnami/fluentd/values-production.yaml index 7a62b4333..5f597cbbc 100644 --- a/bitnami/fluentd/values-production.yaml +++ b/bitnami/fluentd/values-production.yaml @@ -13,7 +13,7 @@ global: {} image: registry: docker.io repository: bitnami/fluentd - tag: 1.7.2-debian-9-r8 + tag: 1.7.3-debian-9-r1 ## Specify a imagePullPolicy ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images diff --git a/bitnami/fluentd/values.yaml b/bitnami/fluentd/values.yaml index 2b05379da..fc4e0050f 100644 --- a/bitnami/fluentd/values.yaml +++ b/bitnami/fluentd/values.yaml @@ -13,7 +13,7 @@ global: {} image: registry: docker.io repository: bitnami/fluentd - tag: 1.7.2-debian-9-r8 + tag: 1.7.3-debian-9-r1 ## Specify a imagePullPolicy ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images