Add support for mounting Alloy config from Kubernetes Secrets #4861
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This enhancement addresses issue #443 by allowing users to mount Grafana Alloy configuration from Kubernetes Secrets instead of only from ConfigMaps. This provides better security for configurations containing sensitive credentials.
Changes
New Features
alloy.secretconfiguration option in values.yaml with the following fields:alloy.secret.create: Create a new Secret for the config filealloy.secret.content: Content to assign to the Secret (supports templating viatpl)alloy.secret.name: Name of existing Secret to usealloy.secret.key: Key in Secret to get config fromImplementation Details
Testing
Documentation
alloy.secretsectionBackward Compatibility
The implementation maintains full backward compatibility with existing ConfigMap-based configurations. Users can continue using ConfigMaps without any changes.
Test Plan
Default behavior (ConfigMap) continues to work:
New Secret creation works:
Referencing existing Secret works:
Usage Example
To use a Secret for your Alloy configuration:
Or to reference an existing Secret:
Fixes #443
🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]