You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
level=error ts=2024-04-19T119:15:17.102Z caller=klog.go:94 component=k8s_client_runtime func=ErrorDepth msg="/app/discovery/kubernetes/kubernetes.go:335: Failed to list *v1.Node: nodes is forbidden: User \"system:serviceaccount:kube-mon:default\" cannot list resource \"nodes\" in API group \"\" at the cluster scope"
k3s 集群内置了 cadvisor,所以我们可以直接利用,核心是 prometheus 的
scrape_configs
中kubernetes_sd_configs
相关配置:注意这里的
ca_file
,bearer_token_file
,这两个配置的值就这么写,prometheus 容器里的这个路径就是正确的,不需要再去做一些 mount。为了能访问通 k3s,我们还需要创建 k8s role,否则看 prometheus 的日志就会发现异常:
创建 role 的 yaml:
然后在
deployment.spec.template.spec.serviceAccountName
中指定上面创建的 role:prometheus
。其他配置就以自己的为准即可。
The text was updated successfully, but these errors were encountered: