-
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:
- Zabbix is deployed in k8s-cluster-1 and able to monitor the cluster itself using the template Kubernetes cluster state by HTTP
- Whenever I try to monitor any other k8s-cluster I get error in the Discovery rule Kubernetes: Get state metrics error
- The service account that I am using is
zabbix-user.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: zabbix-user
namespace: kube-system- —
- apiVersion: v1
- kind: Secret
- type: kubernetes.io/service-account-token
- metadata:
- name: zabbix-user
- namespace: kube-system
- annotations:
- 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)
