Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

[incubator/fluentd] Generalize chart to work with different backends #5357

Closed
wants to merge 5 commits into from

Conversation

goruha
Copy link
Contributor

@goruha goruha commented May 2, 2018

What

  • Made working with environment variables flexible
  • Made Fluentd be daemon set
  • Remove health check
  • Parametrise config mount dir
  • Mount host logs into the container

Why

  • Make chart be flexible enough to work with different fluentd containers (ex. fluentd-cloudwatch)
  • To store secrets private
  • DeamonSet allow collecting logs from all nodes
  • Not all fluentd containers support health checks
  • Different fluentd containers expect configs in a different paths
  • Allow collecting host logs with fluentd in_tail

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 2, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: goruha
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: prydonius

Assign the PR to them by writing /assign @prydonius in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@goruha
Copy link
Contributor Author

goruha commented May 3, 2018

/assign @prydonius

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 7, 2018
@prydonius
Copy link
Member

/assign @rendhalver

apiVersion: apps/v1beta1
kind: Deployment
apiVersion: extensions/v1beta1
kind: DaemonSet
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you switching this to a DaemonSet?
There is an fluentd-elasticsearch chart that does exactly this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's true.
I'd like to make chart general enough for the different use of fluentd.
there are already fluentd-elasticsearch, fluentd-clouwatch.
I use fluentd chart with datadog.
It seems to be a mistake to create a chart for each type of backend.
What do you think about?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea but if we are going to replace all three charts with one it needs to be flexible and configurable enough to do what each of those chart do already without reducing the functionality the current Charts.
I wrote this one to replace logstash in my Elastic-Stack cluster so it didn't need to be a DaemonSet or need access to node logs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things...

  1. If you're going to use something from the workloads api (e.g., DaemonSet) use it from the apps API group. Extensions should not be used anymore.
  2. I like the idea of a fluentd chart that can have handle being installed with various backends. Yet, having different ones for each backend is ok, too. But, we should pick one way and stay consistent with it. If there is one it should cleanly handle all the cases and needs for all of them.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the DaemonSet can be still used as part of a Service then that works for me.
We use this chart to route logs from devices outside our cluster to an ES cluster in Kube so I would like to keep that functionality.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nitpick: deamonset.yaml misspelled)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the DaemonSet can be still used as part of a Service then that works for me

A Service works by selecting Pods according to a selector so it's compatible with DaemonSets which create pods. A Service doesn't care (or know) how the Pods were created.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK awesome. Thank you.

volumeMounts:
- name: varlog
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above. You are basically turning this into the fluentd-elasticsearch chart.
If you are trying to merge these two please make these mounts optional.
There are uses for fluentd that don't involve container logs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rendhalver would it be problem if we will mount logs inside container that do not require them?
I think we need mount logs always and simplify chart install

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?
It's two extra lines to exclude the mounts.
Not every implementation needs them and not all pods should have access to them.

@goruha goruha changed the title Made working with envvars flexible [incubator/fluentd] Generalize chart to work with different backends May 8, 2018
buffer_chunk_limit: 2M
buffer_queue_limit: 8
env:
open:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

configMap would be more clear

Copy link
Contributor Author

@goruha goruha May 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@osterman env shows that we config container with environment variables

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @osterman.
Config maps are clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@osterman @rendhalver can you provide the example of the structure that would you prefer?
I can not get what is the problem

@monotek
Copy link
Collaborator

monotek commented May 10, 2018

Deamonsets are not really updateable as most of the fields are immutable. So using a damon set should be optional.

@goruha
Copy link
Contributor Author

goruha commented May 14, 2018

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 14, 2018
@goruha
Copy link
Contributor Author

goruha commented May 14, 2018

@osterman @mattfarina @monotek @rendhalver
I addressed your comments and provide readme with examples how to use this chart with different backends.
Hope you would find chart flexible enough and ready to release

@monotek
Copy link
Collaborator

monotek commented May 14, 2018

@goruha
I still think daemonset or deployment should be optional.
Maybe one don't wants to use it for kubernetes / docker logs but for sending app logs to the fluentd forward plugin on port 24224.
In this case 1 pod created via a deployment would be enough.

@rendhalver
Copy link
Collaborator

rendhalver commented May 14, 2018

I agree with @monotek here too.
We should have the option of running as a DaemonSet or a Deployment.

@@ -29,15 +34,26 @@ spec:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be dependent on whether the logs are mounted.
If the pod doersn't need access to the logs if shouldn't have root access.

value: {{ .Values.output.buffer_chunk_limit | quote }}
- name: OUTPUT_BUFFER_QUEUE_LIMIT
value: {{ .Values.output.buffer_queue_limit | quote }}
{{- range $name, $value := .Values.env.open }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just have one less level here and put the env vars in env.
Are you planning on putting anything else in this array?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rendhalver can you provide example what structure do you prefer?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

env: instead of env.open:
one less level to the data structure

@@ -49,23 +65,29 @@ spec:
- name: http-input
containerPort: 9880
protocol: TCP
livenessProbe:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this?
We have health checks for a reason.
Do we not want to know if the pods are functioning correctly before we route traffic to them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because liveness probe required config to provide the endpoint for the check.
Not all containers support such configuration.
Instead of that, I disabled supervisor mode, so pod will failed if something goes wrong.
https://github.com/kubernetes/charts/pull/5357/files#diff-6ec61ff69620bf74339bd25610e91021R20

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how that achieves the same ends.

@@ -49,13 +30,6 @@ configMaps:
@type null
</match>

# Used for health checking
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

@monotek
Copy link
Collaborator

monotek commented May 15, 2018

Imho we should also provide 2 configmaps for optional deployment / daemonset.

If deployment is used I'm pretty sure most of the current config is unwanted.

@goruha
Copy link
Contributor Author

goruha commented Jul 5, 2018

I think we try to mix different purpose charts.
My suggestion is to have 2 charts

  • fluentd - for fluentd as independent software (so leave this chart as is and close PR)
  • fluentd_kubernetes - run fluentd to collect kubernetes logs and forward it to different backends (create a new chart with separate PR)

What do you think about ?
@monotek @osterman @mattfarina @rendhalver @prydonius

@monotek
Copy link
Collaborator

monotek commented Jul 5, 2018

Imho if different fluentd images has to be used (output plugins) we should also use different charts.

@rendhalver
Copy link
Collaborator

We have separate charts for the different usages.
We currently have multiple charts for the logging that send to different backends.

Calling the logging chart fluentd_kubernetes isn't the best choice of name, fluentd-logging or fluentd-container-logging would be a better name and more explicitly explains what it does.

@stale
Copy link

stale bot commented Aug 18, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

@stale stale bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 18, 2018
@mattfarina mattfarina added the Contribution Allowed If the contributor has signed the DCO or the CNCF CLA (prior to the move to a DCO). label Aug 27, 2018
@stale stale bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 27, 2018
@stale
Copy link

stale bot commented Sep 17, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

@stale stale bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 17, 2018
@stale
Copy link

stale bot commented Oct 2, 2018

This issue is being automatically closed due to inactivity.

@stale stale bot closed this Oct 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. Contribution Allowed If the contributor has signed the DCO or the CNCF CLA (prior to the move to a DCO). lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants