ability to set resources for vmagent (and probably other components) in victoria-metrics-k8s-stack
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.
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:
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?
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.
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.
Thanks but it would be great to have ability to set limits and requests separately.
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?
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 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.
which k8s-stack version are you using?
@AndrewChubatiuk helm victoria-metrics-k8s-stack, version: 0.28.4.
victoriametrics/operator:v0.49.0
wasn't able to reproduce, resources of vmagent container in deployment were updated successfully
@AndrewChubatiuk Sorry I've just realized that I was looking at the config-reloader limits. Thanks for your answer.