Target shows `server returned HTTP status 403 Forbidden` when scraping kubelet / cAdvisor
IntermediateTroubleshootingPrometheus scraping and targets
Answer
Likely causes → The Prometheus ServiceAccount lacks RBAC for nodes/metrics or nodes/proxy, or the kubelet has webhook authorization on and the token is not bound.
Diagnose →
kubectl auth can-i get nodes/metrics --as=system:serviceaccount:monitoring:prometheus-k8s
kubectl auth can-i get nodes/proxy --as=system:serviceaccount:monitoring:prometheus-k8s
Fix → Grant a ClusterRole with nodes, nodes/metrics, services, endpoints, pods (get/list/watch) and nonResourceURLs: ["/metrics"], bound to the SA. Use bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token.
Prevent → Install via kube-prometheus-stack, which ships correct RBAC, and test with kubectl auth can-i in CI.
More on Prometheus scraping and targets
A target shows `DOWN` on `/targets` with `Get "http://10.0.3.14:9100/metrics": context deadline exceeded`BeginnerTarget is `DOWN` with `server returned HTTP status 401 Unauthorized`BeginnerTarget is `DOWN` with `connect: connection refused`BeginnerTarget shows `x509: certificate signed by unknown authority`IntermediateTarget shows `x509: certificate is valid for app.svc, not 10.0.4.22`IntermediateA target is `UP` but `/targets` shows `expected a valid start token, got "<" ("INVALID") while parsing: "<"`Intermediate