Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for TLS client settings for clustering #1724

Merged
merged 9 commits into from
Oct 2, 2024

Conversation

tiagorossig
Copy link
Contributor

@tiagorossig tiagorossig commented Sep 20, 2024

PR Description

Clustering in TLS environments was not possible before these changes.

Why is this change required

My organization runs alloy pods in environments that require all pod communication to be over HTTPS with TLS encryption. When enabling clustering, we noticed that communication between pods was blocked because it was going over HTTP.

Testing

Built alloy from this branch and used the enable-tls CLI flag with the appropriate certificate material to configure the TLS client. Made sure that pods can still communicate amongst themselves and constantly converge on the cluster's state.

Some logs that confirm pod communication still works:

{"ts":"2024-09-20T22:36:54.802881244Z","level":"debug","service":"cluster","component":"memberlist","ts":"2024/09/20 22:36:54","caller":"[DEBUG] memberlist: Initiating push/pull sync with: <ip>.ec2.internal <pod1-ip>"}
{"ts":"2024-09-20T22:36:54.804031852Z","level":"debug","msg":"merging remote state","service":"cluster","remote_time":34}
{"ts":"2024-09-20T22:37:02.656126162Z","level":"debug","msg":"received DNS query response","service":"cluster","addr":"<cluster-address>","record_type":"A/AAAA","records_count":3}
{"ts":"2024-09-20T22:37:02.656152001Z","level":"debug","msg":"discovered peers","service":"cluster","peers_count":3,"peers":"<pod0-ip>,<pod1-ip>,<pod2-ip>"}
{"ts":"2024-09-20T22:37:02.656158483Z","level":"info","msg":"rejoining peers","service":"cluster","peers_count":3,"peers":"<pod0-ip>,<pod1-ip>,<pod2-ip>"}
{"ts":"2024-09-20T22:37:02.657273362Z","level":"debug","service":"cluster","component":"memberlist","ts":"2024/09/20 22:37:02","caller":"[DEBUG] memberlist: Initiating push/pull sync with:  <pod0-ip>"}
{"ts":"2024-09-20T22:37:02.658438004Z","level":"debug","msg":"merging remote state","service":"cluster","remote_time":35}
{"ts":"2024-09-20T22:37:02.65934668Z","level":"debug","service":"cluster","component":"memberlist","ts":"2024/09/20 22:37:02","caller":"[DEBUG] memberlist: Initiating push/pull sync with:  <pod1-ip>"}
{"ts":"2024-09-20T22:37:02.660418062Z","level":"debug","msg":"merging remote state","service":"cluster","remote_time":34}
{"ts":"2024-09-20T22:37:02.660630938Z","level":"debug","service":"cluster","component":"memberlist","ts":"2024/09/20 22:37:02","caller":"[DEBUG] memberlist: Stream connection from=<pod2-ip>"}
{"ts":"2024-09-20T22:37:02.660723496Z","level":"debug","service":"cluster","component":"memberlist","ts":"2024/09/20 22:37:02","caller":"[DEBUG] memberlist: Initiating push/pull sync with:  <pod2-ip>"}
{"ts":"2024-09-20T22:37:02.661081355Z","level":"debug","msg":"merging remote state","service":"cluster","remote_time":36}

Grafana Alloy debugging UI also shows that clustered pods can still recognize each other:
Screenshot 2024-09-20 at 5 49 24 PM

Which issue(s) this PR fixes

Fixes #367

Notes to the Reviewer

This PR depends on grafana/ckit#63, which has not yet been merged.

PR Checklist

  • CHANGELOG.md updated
  • Documentation added
  • Tests updated
  • Config converters updated

go.mod Outdated Show resolved Hide resolved
@tiagorossig tiagorossig marked this pull request as ready for review September 20, 2024 22:52
docs/sources/reference/cli/run.md Outdated Show resolved Hide resolved
docs/sources/reference/cli/run.md Outdated Show resolved Hide resolved
docs review

Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com>
@clayton-cornell clayton-cornell added the type/docs Docs Squad label across all Grafana Labs repos label Sep 24, 2024
@clayton-cornell clayton-cornell requested a review from a team September 24, 2024 16:08
@mattdurham mattdurham enabled auto-merge (squash) October 1, 2024 17:50
Copy link
Collaborator

@mattdurham mattdurham left a comment

Choose a reason for hiding this comment

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

LGTM

@mattdurham
Copy link
Collaborator

Looks good to me, if you can resolve the conflict automerge will merge it.

auto-merge was automatically disabled October 1, 2024 18:31

Head branch was pushed to by a user without write access

@tiagorossig
Copy link
Contributor Author

@mattdurham Much appreciated! Resolved the CHANGELOG.md conflict

@mattdurham mattdurham enabled auto-merge (squash) October 1, 2024 19:05
auto-merge was automatically disabled October 1, 2024 20:09

Head branch was pushed to by a user without write access

@tiagorossig
Copy link
Contributor Author

@tiagorossig
Copy link
Contributor Author

@mattdurham Could you give me a hand taking a look at the failing test? It doesn't seem related to any changes here, so I'm a bit puzzled.

@mattdurham mattdurham merged commit 5c773d2 into grafana:main Oct 2, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/docs Docs Squad label across all Grafana Labs repos
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flow: Support TLS client settings for clustering
3 participants