Kubernetes cluster state by HTTP: Kubernetes: Get state metrics error

XMLWordPrintable

    • Type: Problem report
    • Resolution: Fixed
    • Priority: Trivial
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      I have seen other requests opened regarding this error, but have not been able to resolve them.

      Steps to reproduce:

      1. Zabbix is deployed in k8s-cluster-1 and able to monitor the cluster itself using the template Kubernetes cluster state by HTTP
      2. Whenever I try to monitor any other k8s-cluster I get error in the Discovery rule Kubernetes: Get state metrics error
      3. The service account that I am using is 
        zabbix-user.yaml

        apiVersion: v1
        kind: ServiceAccount
        metadata:
          name: zabbix-user
          namespace: kube-system

        1. apiVersion: v1
        2. kind: Secret
        3. type: kubernetes.io/service-account-token
        4. metadata:
        5.   name: zabbix-user
        6.   namespace: kube-system
        7.   annotations:
        8.     kubernetes.io/service-account.name: "zabbix-user"

          apiVersion: rbac.authorization.k8s.io/v1
          kind: ClusterRole
          metadata:
            name: zabbix-user
            namespace: kube-system
          rules:
        • apiGroups:
            - ""
            resources:
            - pods
            - pods/metrics
            - services
            - nodes
            - nodes/metrics
            - namespaces
            - apiservices
            - componentstatuses
            - endpoints
            - events
            verbs:
            - get
            - list
        • apiGroups:
            - "apiregistration.k8s.io"
            resources:
            - apiservices
            verbs:
            - get
            - list
            - watch
        • apiGroups:
            - "apps"
            resources:
            - deployments
            verbs:
            - get
            - list
            - watch
        • nonResourceURLs:
            - "/api"
            - "/metrics"
            - "/metrics/cadvisor"
            - "/version"
            - "/healthz"
            - "/readyz"
            verbs: ["get", "list", "watch"]
        • apiGroups: [""]
            resources:
            - nodes/metrics
            - nodes/spec
            - nodes/proxy
            - nodes/stats
            verbs: ["get"]
        • apiGroups: ["batch"]
            resources:
            - jobs
            - cronjobs
            verbs: ["get", "list"]
        • apiGroups: ["extensions"]
            resources:
            - deployments
            - daemonsets
            verbs: ["get", "list"]
        • apiGroups: ["apps"]
            resources:
            - statefulsets
            - deployments
            - daemonsets
            verbs: ["get", "list"]
        • apiGroups: ["metrics.k8s.io"]
            resources: ["pods", "nodes"]
            verbs: ["get", "list", "watch"]

          apiVersion: rbac.authorization.k8s.io/v1
          kind: ClusterRoleBinding
          metadata:
            name: zabbix-user
            namespace: kube-system
          roleRef:
            apiGroup: rbac.authorization.k8s.io
            kind: ClusterRole
            name: zabbix-user
          subjects:
        • kind: ServiceAccount
            name: zabbix-user
            namespace: kube-system

      Result:
      Expected:
      k8s-cluster-1 (cluster where zabbix is deployed)

        1. image-2023-02-10-10-52-32-430.png
          176 kB
          Muhammad Naeem Akhtar
        2. image-2023-02-10-10-54-46-514.png
          168 kB
          Muhammad Naeem Akhtar

            Assignee:
            Denis Rasikhov (Inactive)
            Reporter:
            Muhammad Naeem Akhtar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: