apiVersion: operator.victoriametrics.com/v1beta1
kind: VMRule
metadata:
  name: alerts-k8s.rules.containercpuusagesecondstotal
spec:
  groups:
  - name: k8s.rules.container_cpu_usage_seconds_total
    params: {}
    rules:
    - annotations: {}
      expr: |-
        sum by (namespace,pod,container,cluster) (
          irate(container_cpu_usage_seconds_total{job="kubelet", metrics_path="/metrics/cadvisor", image!=""}[5m])
        ) * on (namespace,pod,cluster) group_left(node) topk by (namespace,pod,cluster) (
          1, max by (namespace,pod,node,cluster) (kube_pod_info{node!=""})
        )
      labels: {}
      record: node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate
