level=error ts=2020-03-05T02:56:36.493Z caller=klog.go:94 component=k8s_client_runtime func=ErrorDepth msg=”/app/discovery/kubernetes/kubernetes.go:263: Failed to list v1.Endpoints: endpoints is forbidden: User \”system:serviceaccount:monitoring:prometheus-k8s\” cannot list resource \”endpoints\” in API group \”\” at the cluster scope” level=error ts=2020-03-05T02:56:37.491Z caller=klog.go:94 component=k8s_client_runtime func=ErrorDepth msg=”/app/discovery/kubernetes/kubernetes.go:264: Failed to list v1.Service: services is forbidden: User \”system:serviceaccount:monitoring:prometheus-k8s\” cannot list resource \”services\” in API group \”\” at the cluster scope” level=error ts=2020-03-05T02:56:37.494Z caller=klog.go:94 component=k8s_client_runtime func=ErrorDepth msg=”/app/discovery/kubernetes/kubernetes.go:265: Failed to list *v1.Pod: pods is forbidden: User \”system:serviceaccount:monitoring:prometheus-k8s\” cannot list resource \”pods\” in API group \”\” at the cluster scope”
很多出错日志,主要是上面三条的循环出现。
Failed to list *v1.Endpoints: endpoints is forbidden: User \”system:serviceaccount:monitoring:prometheus-k8s\” cannot list resource \”endpoints\” in API group \”\” at the cluster scope.
Failed to list *v1.Service: services is forbidden: User \”system:serviceaccount:monitoring:prometheus-k8s\” cannot list resource \”services\” in API group \”\” at the cluster scope.
Failed to list *v1.Pod: pods is forbidden: User \”system:serviceaccount:monitoring:prometheus-k8s\” cannot list resource \”pods\” in API group \”\” at the cluster scope.
endpoints/services/pods is forbidden,说明是RBAC权限问题,namespace: monitoring下的serviceaccount: prometheus-k8s这个用户没有权限。
# docker system prune WARNING! This will remove: - all stopped containers - all networks not used by at least one container - all dangling images - all build cache Are you sure you want to continue? [y/N] y Deleted Containers: 64d81b1dc03026478f0114b657d4cd938967868967e5e5ee9b8ea3d72814a736 c5f180a1c5c2804d45d13d11f338d241e482ada9673bff0ba8cc18759ae4fcae aa06316b5fd638c22fc41bd8f8ea4c511566c4c537c81bf5aad5f276ac6c2fae ce5048ebf25bd48bbe1372aaf38c68078a05c06157ffcb4a8e646470f647acb0 0c4b37413e3483366fb640b94ad33596aef149a50bc610a2d720663159280871 7575ec0a092bc9d3dd1a54ac2e3b92ce0dd8f3f570565ecc918684b0c51087ea 1e335ee77f4167c19f6e54a1728d3d49775f651d871009752b1cfb7ec9fd7867 393bd6280ecf423804c27f264cfc95e72df7580dc6881bb1a249152b4554b10e 63ad5c44a30c80645e84b16cc8e1009e46235bd7001153f8d8d3c4887ed18786 ee8c92a30092e7c30338d2a6721d13f250c2a426947a29c2e2c30f9936c0e07a cd49e432a75a5f9719e8436af70a40e9869e02db51c4f8c08f02ad26a6bdc3ba 35435e8cd10d2dd9b26993da909aba31f4d52df3475b30ba7536d473004c7e91 6028cf4eac7090a89c05edad7e45096130ee7e3336f28d2c0e2a890111d80043 6e1d20022ecdd871a684b016c89d4d1122c9c5a00de998f921e2eacbd54da482 6417077821f3fc76da1e436401b0ed58a842b8afec6134c3895d5f3c7ae8d069 b49f44b5a26aad43d9d7b0f1ff57b659d4aab90d13477063160862018d3ba6f3