Skip to content

Infra alers in tenants monitoring #2775

Open

Description

@dvc

Describe the bug

In tenant alerta i see 5 alerts:

  • CDI operator is down
  • Kubelet has disappeared from Prometheus target discovery.
  • KubeAPI has disappeared from Prometheus target discovery.
  • KubeControllerManager has disappeared from Prometheus target discovery.
  • KubeScheduler has disappeared from Prometheus target discovery.

All of alerts shows that no infra metrics in tenant VM. As expected.

Environment

  • Cozystack version: any
  • Provider: any

To Reproduce
Steps to reproduce the behavior:

  1. Add tenant with monitoring
  2. Go to tenant alerta -> /alerts
  3. Look at alerts table

Expected behaviour
No infra alerts deployed in tenants monitoring

Actual behaviour
https://github.com/cozystack/cozystack/blob/main/packages/system/monitoring-agents/templates/alerts.yaml

no custom logic for infra and tenant monitoring.

Logs

Screenshots
Image

Additional context

Checklist

  • I have checked the documentation
  • I have searched for similar issues
  • I have included all required information
  • I have provided clear steps to reproduce
  • I have included relevant logs

Activity

  1. dosubot commented on Jun 1, 2026

    @dosubot

    This is a valid issue. The monitoring-agents package currently deploys all alert rules globally without distinguishing between infrastructure and tenant contexts [1]. The alerts for Kubelet, KubeAPI, KubeControllerManager, and KubeScheduler are defined in the alerts/ directory and included unconditionally via a Helm glob pattern.

    This is the same class of problem that was addressed for dashboards in issue #2194 [2] — infrastructure dashboards were scoped to tenant-root/cozy-monitoring namespaces via conditional rendering in PR #2197 [3]. However, the same scoping was never applied to the alert rules.

    A similar fix could be applied to alerts.yaml by wrapping infrastructure-specific alert files in a namespace conditional, following the established dashboard pattern [4]:

    {{- if or (eq .Release.Namespace "tenant-root") (eq .Release.Namespace "cozy-monitoring") }}
    # Include infrastructure-only alerts (kubelet, kube-apiserver, kube-controller-manager, kube-scheduler)
    {{- end }}

    This would require splitting the alert files in the alerts/ directory into infrastructure-specific (kubelet, kube-apiserver, kube-controller-manager, kube-scheduler) and workload-generic (apps, storage, node resources) groups, then conditionally including only the infrastructure alerts when deploying to tenant-root or cozy-monitoring.

    To reply, just mention @dosu.


    Share context across your team and agents. Try Dosu.

    Leave Feedback Learn about cozystack with Dosu Add Dosu to your team

  2. dvc commented on Jun 1, 2026

    @dvc
    ContributorAuthor

    see also vmalert setting

    https://docs.victoriametrics.com/operator/resources/vmalert/#rules

    Following rules are applied:

    If ruleNamespaceSelector and ruleSelector both undefined, then by default select nothing. With option set - spec.selectAllByDefault: true, select all vmrules.
    If ruleNamespaceSelector defined, ruleSelector undefined, then all vmrules are matching at namespaces for given ruleNamespaceSelector.
    If ruleNamespaceSelector undefined, ruleSelector defined, then all vmrules at VMAlert’s namespaces are matching for given ruleSelector.
    If ruleNamespaceSelector and ruleSelector both defined, then only vmrules at namespaces matched ruleNamespaceSelector for given ruleSelector are matching.

    related to discussion about grafana dashboards. IMHO ))

  3. added
    area/monitoringIssues or PRs related to the monitoring stack (vlogs, vmstack, grafana, workloadmonitor)
    triage/acceptedIndicates an issue is ready to be actively worked on
    priority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to complete
    on Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/monitoringIssues or PRs related to the monitoring stack (vlogs, vmstack, grafana, workloadmonitor)kind/bugCategorizes issue or PR as related to a bugpriority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to completetriage/acceptedIndicates an issue is ready to be actively worked on

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions