helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

ability to set resources for vmagent (and probably other components) in victoria-metrics-k8s-stack

Open fenio opened this issue 1 year ago • 6 comments

victoria-metrics-k8s-stack comes with some defaults for example for vmagent:

    Limits:
      cpu:     200m
      memory:  500Mi
    Requests:
      cpu:        50m
      memory:     200Mi

I'm hitting these limits and I see no way to change it using that helm chart others than to switch to separate vm-single + vm-operator.

fenio avatar Jan 13 '24 17:01 fenio

Hello, there is no default resources setting for vmagent in victoria-metrics-k8s-stack, so vm-operator will use the default envs VM_VMAGENTDEFAULT_RESOURCE_* if they are not specified under vmagentSpec. You can change it by adding them in values like

vmagent:
  enabled: true
  # spec for VMAgent crd
  # https://docs.victoriametrics.com/operator/api.html#vmagentspec
  spec:
    resources:
      cpu:

Haleygo avatar Jan 15 '24 07:01 Haleygo

Thank you @Haleygo. WIth your hint I was able to do a lot of progress. And I got familiar with API specs. How about setting limits/resources for config-reloader containers which are part of many components from victoria-metrics-k8s-stack? I tried to use envs like this but it doesn't work:

values: env: VM_VMSINGLEDEFAULT_CONFIGRELOADERCPU: null VM_VMALERTDEFAULT_CONFIGRELOADERCPU: null VM_VMAGENTDEFAULT_CONFIGRELOADERCPU: null

What's the correct way to set these settings?

fenio avatar Feb 07 '24 19:02 fenio

https://github.com/fenio/homelab/blob/main/cluster/apps/monitor/victoria-metrics/app/helmrelease.yaml Just in case you'd want more details this is how I'm deploying VM on my cluster.

fenio avatar Feb 07 '24 19:02 fenio

If you don't want to set any CPU you can use the following:

  env:
    - name: VM_VMALERTDEFAULT_CONFIGRELOADERCPU
      value: 0
    - name: VM_VMAGENTDEFAULT_CONFIGRELOADERCPU
      value: 0
    - name: VM_VMALERTMANAGER_CONFIGRELOADERCPU
      value: 0

But there isn't a way to set requests different from limits. Proper resource blocks should be added to the CRDs for these 3 microservices.

ben-nelson-nbcuni avatar Feb 13 '24 04:02 ben-nelson-nbcuni

Thanks but it would be great to have ability to set limits and requests separately.

fenio avatar Feb 13 '24 05:02 fenio

Also focusing only on limits/requests for cpu/memory makes it impossible to set limits/requests for other stuff like ephemeral-storage. Not to say that modifying security context is also an issue. Why don't you simply allow to set all these values in chart instead of using env variables approach?

fenio avatar Feb 19 '24 17:02 fenio

vmagent resources, volumes, security context management are all available in VMAgentSpec. Environment variables are used only for default values for some generic configs, like registry, config-reloader, etc. If you think there are some extra properties should be available in VMAgentSpec, please submit an issue in operator repo

AndrewChubatiuk avatar Aug 21 '24 06:08 AndrewChubatiuk

@AndrewChubatiuk Adding the following configuration:

vmagent:
  spec:
    resources:
      limits:
        memory: 250Mi
      requests:
        memory: 250Mi
        cpu: 100m

Doesn't work. I can see the correct specification in the "vmagent" resource type, but the deployment is still using the default values.

JavierPorron avatar Nov 27 '24 12:11 JavierPorron

which k8s-stack version are you using?

AndrewChubatiuk avatar Nov 27 '24 12:11 AndrewChubatiuk

@AndrewChubatiuk helm victoria-metrics-k8s-stack, version: 0.28.4.

victoriametrics/operator:v0.49.0

JavierPorron avatar Nov 27 '24 12:11 JavierPorron

wasn't able to reproduce, resources of vmagent container in deployment were updated successfully

AndrewChubatiuk avatar Nov 27 '24 14:11 AndrewChubatiuk

@AndrewChubatiuk Sorry I've just realized that I was looking at the config-reloader limits. Thanks for your answer.

JavierPorron avatar Nov 28 '24 16:11 JavierPorron