Skip to content

🌱 Promtail to alloy migration #11945

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

irapandey
Copy link
Contributor

What this PR does / why we need it:
This PR is to migrate from promtail to alloy

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #
#11881

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 10, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign enxebre for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@k8s-ci-robot k8s-ci-robot added do-not-merge/needs-area PR is missing an area label needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 10, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @irapandey. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 10, 2025
@irapandey irapandey changed the title Promtail to alloy migration 🌱 Promtail to alloy migration Mar 10, 2025
@irapandey
Copy link
Contributor Author

Screenshot 2025-03-10 at 3 09 48 PM

@irapandey
Copy link
Contributor Author

Hey @chrischdi

I have opened this PR for promtail/alloy migration
Please take a look here.

Thanks 😄

@chrischdi
Copy link
Member

/ok-to-test

/area devtools

Can you also check grafana if you're able to query logs?

@k8s-ci-robot k8s-ci-robot added area/devtools Issues or PRs related to devtools ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. do-not-merge/needs-area PR is missing an area label labels Mar 13, 2025
@@ -1,5 +1,3 @@
# Configuration for promtail chart, see https://github.com/grafana/helm-charts/tree/main/charts/promtail
Copy link
Member

Choose a reason for hiding this comment

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

Can we add the right link for alloy?

Copy link
Member

@chrischdi chrischdi Mar 26, 2025

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

❯ helm show chart grafana/alloy
apiVersion: v2
appVersion: v1.7.2
dependencies:
- condition: crds.create
  name: crds
  repository: ""
  version: 0.0.0
description: Grafana Alloy
icon: https://raw.githubusercontent.com/grafana/alloy/main/docs/sources/assets/alloy_icon_orange.svg
name: alloy
type: application
version: 0.12.3

@@ -1,5 +1,3 @@
# Configuration for promtail chart, see https://github.com/grafana/helm-charts/tree/main/charts/promtail

config:
Copy link
Member

Choose a reason for hiding this comment

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

Pretty sure we have to change things here as its a different helm chart.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't find dedicated charts for alloy like for promtail - https://grafana.com/docs/alloy/latest/set-up/install/kubernetes/

Copy link
Member

Choose a reason for hiding this comment

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

helm show values grafana/alloy does not even have a config field.

So all configuration below would be not used (and we want them to work).

So I'm curious if this even shows us logs.

Copy link
Member

Choose a reason for hiding this comment

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

This page maybe helps: https://grafana.com/docs/alloy/latest/set-up/migrate/from-promtail/

Note: the values.yaml is not the promtail configuration.

Copy link
Member

Choose a reason for hiding this comment

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

You should get the promtail.yaml via: kustomize build --enable-helm --load-restrictor LoadRestrictionsNone hack/observability/promtail | grep stringData -A 38 | yq '.stringData[]' > promtail.yaml

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me take a look and get back - I kinda had the same feeling but needed some input
Thanks 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apologies for being MIA

I believe since Alloy used .alloy files to run - we simply add the converted promtail config to ./alloy dir and run alloy using this file

I commiting the file so you can review

@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 Apr 15, 2025
@chrischdi
Copy link
Member

I ran tilt-up and accessed grafana.

I'm not able to see any logs so looks like alloy does not work in that configuration which is currently on the PR.

image

@@ -1,5 +1,4 @@
# Configuration for promtail chart, see https://github.com/grafana/helm-charts/tree/main/charts/promtail

# Configuration for alloy - https://github.com/grafana/alloy/blob/main/operations/helm/charts/alloy/values.yaml
config:
Copy link
Member

@chrischdi chrischdi Apr 15, 2025

Choose a reason for hiding this comment

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

I think we need to replace the file with this content:

# Configuration for alloy - https://github.com/grafana/alloy/blob/main/operations/helm/charts/alloy/values.yaml

alloy:
  configMap:
    create: true
    name: alloy-config
    key: config.alloy
  mounts:
    varlog: true

namespace: observability
valuesFile: values.yaml
version: 6.16.6
version: 0.12.3

helmGlobals:
# Store chart in ".charts" folder instead of "charts".
Copy link
Member

Choose a reason for hiding this comment

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

We need to add the following at the end to create the configmap which contaings the data of config.alloy:

namespace: observability

configMapGenerator:
- name: alloy-config
  files:
  - config.alloy

@chrischdi
Copy link
Member

Let's have these two changes, then please check in grafana if we get logs.

After that works we can start to verify that the new config has the same effect as the previous promtail config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devtools Issues or PRs related to devtools cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants