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

Passing promscrape.cluster.memberNum argument in k8s is not easy as it is of type INT #2359

Closed
venkatbvc opened this issue Mar 24, 2022 · 4 comments
Labels
enhancement New feature or request vmagent

Comments

@venkatbvc
Copy link
Contributor

Is your feature request related to a problem? Please describe.

To use cluster feature of vmagent, promscrape.cluster.memberNum argument has to be passed. In k8s, It is difficult to pass this argument unless a wrapper script is written to start the vmagent. But in distroless, we cannot have a wrapper script.

Describe the solution you'd like

In k8s, cluster version can be deployed as statefulset, ${HOSTNAME##*-} gives the oridnal number of the pod. If memberNum parameter can be evaluated from the above expression then it will ease installation in k8s environment. Or read this from a file so that proper number would be generated.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@hagen1778
Copy link
Collaborator

cc @tenmozes @f41gh7
is this related to operator/helm-charts repos?

@hagen1778 hagen1778 added the enhancement New feature or request label Apr 11, 2022
f41gh7 added a commit that referenced this issue Apr 11, 2022
it must improve user expirience and simplify clustering scrapers.
it must allow to use vmagent cluster with distroless images
#2359
@f41gh7
Copy link
Contributor

f41gh7 commented Apr 11, 2022

I think, it's related to vmagent itself. If it improve user experience, we should it.

Example of usage for statefulset based deployments:

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: vmagent
spec:
  template:
    spec:
      containers:
      - name: vmagent
        args:
         # must be enabled
        - envflag.enable
        env:
        - name: promscrape_cluster_memberNum
          valueFrom:
            fieldRef:
              fieldPath: metadata.name

@f41gh7 f41gh7 added the vmagent label Apr 11, 2022
@venkatbvc
Copy link
Contributor Author

@f41gh7 Yes it is related to VMagent.

valyala added a commit that referenced this issue Apr 12, 2022
* lib/promscrape: allows to use k8s pod name as clusterMemberNum
it must improve user expirience and simplify clustering scrapers.
it must allow to use vmagent cluster with distroless images
#2359

* Apply suggestions from code review

Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
valyala added a commit that referenced this issue Apr 12, 2022
* lib/promscrape: allows to use k8s pod name as clusterMemberNum
it must improve user expirience and simplify clustering scrapers.
it must allow to use vmagent cluster with distroless images
#2359

* Apply suggestions from code review

Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
@valyala
Copy link
Collaborator

valyala commented Apr 12, 2022

vmagent accepts statefulset pod names at -promscrape.cluster.memberNum command-line flag starting from v1.76.1. For example, the following command-line flag -promscrape.cluster.memberNum=vmagent-0 is equivalent to -promscrape.cluster.memberNum=0. See these docs for more details.

@valyala valyala closed this as completed Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request vmagent
Projects
None yet
Development

No branches or pull requests

4 participants