fluentd-cloudwatch

by VEriK Systems

Helm chartv1.1.0App v1.16.3-debian-cloudwatch-amd64-2.1

Chart for configure send logs to CloudWatch Logs

About this chart

AWS CloudWatch Logs Agent Helm Chart

This chart bootstraps a AWS CloudWatch Logs Agent with fluentd deployment on a Kubernetes cluster using the Helm package manager.

TL;DR

$ helm repo add verik-charts https://charts.veriksystems.com
$ helm install my-release verik-charts/fluentd-cloudwatch

Prerequisites

  • Kubernetes 1.19+
  • Helm 3.1.0
  • PV provisioner support in the underlying infrastructure

Installing the Chart

To install the chart with the release name my-release:

$ helm install my-release verik-charts/fluentd-cloudwatch

The command deploys Redmine on the Kubernetes cluster in the default configuration. The Parameters 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 deployment:

$ helm delete my-release

The command removes all the Kubernetes components associated with the chart and deletes the release.

Parameters

Global Parameters

NameDescriptionValue
labels.appcommon app labelfluentd-cloudwatch
labels.app.kubernetes.io/namecommon Kubernetes app labelundefined
labels.app.kubernetes.io/componentcommon Kubernetes app component labelundefined
labels.k8s-appanother k8s app namefluentd-cloudwatch
serviceAccount.nameservice account namefluentd
clusterRole.rules[0].apiGroupsapi groups rules[""]
clusterRole.rules[0].resourcesresources is applied["namespaces","pods","pods/logs"]
clusterRole.rules[0].verbsresources verbs is applied["get","list","watch"]

Resource quota configuraiton Parameters

NameDescriptionValue
resources.limits.cpuKubernetes resources limit cpu configure100m
resources.limits.memoryKubernetes resources limit memory configure512Mi
resources.requests.cpuKubernetes resources requests cpu configure100m
resources.requests.memoryKubernetes resources requests memory configure256Mi

configuraiton Parameters

NameDescriptionValue
daemonSet.annotations.configHashconfig hash8915de4cf9c3551a8dc74c0137a3e83569d28c71044b0359c2578d2e0461825
configMap.clusterInfo.cluster.namecluster nameundefined
configMap.clusterInfo.logs.regionregion logsundefined
configMap.data.fluent.confconfig of fluentdundefined
configMap.data.containers.confconfig of fluentdundefined
configMap.data.systemd.confconfig of fluentdundefined
configMap.data.host.confconfig of fluentdundefined

@include systemd.conf @include host.conf

<match fluent.**> @type null | |configMap.data.containerConfig | config of fluentd | @type tail @id in_tail_container_logs @label @containers path /var/log/containers/.log exclude_path ["/var/log/containers/cloudwatch-agent", "/var/log/containers/fluentd*"] pos_file /var/log/fluentd-containers.log.pos tag * read_from_head true @type json time_format %Y-%m-%dT%H:%M:%S.%NZ

<label @fluentdlogs> <filter **> @type kubernetes_metadata @id filter_kube_metadata_fluentd

<filter **> @type record_transformer @id filter_fluentd_stream_transformer stream_name ${tag_parts[3]} remove_keys $.kubernetes.pod_id, $.kubernetes.master_url, $.kubernetes.container_image_id, $.kubernetes.namespace_id

<match **> @type relabel @label @NORMAL

<label @containers> <filter **> @type kubernetes_metadata @id filter_kube_metadata

<filter **> @type record_transformer @id filter_containers_stream_transformer stream_name ${tag_parts[3]} remove_keys $.kubernetes.pod_id, $.kubernetes.master_url, $.kubernetes.container_image_id, $.kubernetes.namespace_id

<filter **> @type concat key log multiline_start_regexp /^\S/ separator "" flush_interval 5 timeout_label @NORMAL

<match **> @type relabel @label @NORMAL

<label @cwagentlogs> <filter **> @type kubernetes_metadata @id filter_kube_metadata_cwagent

<filter **> @type record_transformer @id filter_cwagent_stream_transformer stream_name ${tag_parts[3]} remove_keys $.kubernetes.pod_id, $.kubernetes.master_url, $.kubernetes.container_image_id, $.kubernetes.namespace_id

<filter **> @type concat key log multiline_start_regexp /^\d{4}[-/]\d{1,2}[-/]\d{1,2}/ separator "" flush_interval 5 timeout_label @NORMAL

<match **> @type relabel @label @NORMAL

<label @NORMAL> <match **> @type cloudwatch_logs @id out_cloudwatch_logs_containers region "#{ENV.fetch('REGION')}" log_group_name "/aws/containerinsights/#{ENV.fetch('CLUSTER_NAME')}/application" log_stream_name_key stream_name remove_log_stream_name_key true auto_create_stream true flush_interval 5 chunk_limit_size 2m queued_chunks_limit_size 32 retry_forever true | |configMap.data.systemd.conf | config of fluentd |undefined | |configMap.data.host.conf | config of fluentd |undefined`

Deploy fluentd-cloudwatch with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has fluentd-cloudwatch on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartfluentd-cloudwatch is pinned at v1.1.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply