Summary
I have a microk8s 2-node cluster(one is the control plane and another is worker node)
I can access Prometheus metrics following components
API Server
kube-proxy
dns
Not able to access Prometheus metrics of the following components
Kube-scheduler
Kube-contol-manager
What Should Happen Instead?
As per this official doc: https://microk8s.io/docs/services-and-ports they run on 10259 and 10257
expectation is that able to access the metrics of scheduler and controller using standard Prometheus scrape configuration , but I am not able to.
- job_name: kube-scheduler
honor_labels: true
scrape_interval: 2m
scrape_timeout: 55s
metrics_path: /metrics
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
scheme: https
tls_config:
insecure_skip_verify: true
static_configs:
- targets: ["127.0.0.1:10259"]
- job_name: kube-controller-manager
scrape_interval: 2m
scrape_timeout: 55s
metrics_path: /metrics
scheme: https
static_configs:
- targets: ["127.0.0.1:10257"]
honor_labels: true
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
tls_config:
insecure_skip_verify: true
But is not working even though my service account has cluster-admin role , when I access above ports, I am getting 403, tried with certificates also, please find below
curl -k -H "Authorization: Bearer $token" curl https://127.0.01:10257/metrics
curl: (6) Could not resolve host: curl
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": "forbidden: User \"system:anonymous\" cannot get path \"/metrics\"",
"reason": "Forbidden",
"details": {},
"code": 403
Same goes with the Kube-scheduler also
Reproduction Steps
I have attached in the comment section to reproduce.
Introspection Report
I am not allowed to copy cluster data
Can you suggest a fix?
I am not sure but it is good to have seperate metrics for each K8s component on their own dedicated port.
Are you interested in contributing with a fix?
No, I do not have skillset
Thank you.
Summary
I have a microk8s 2-node cluster(one is the control plane and another is worker node)
I can access Prometheus metrics following components
API Server
kube-proxy
dns
Not able to access Prometheus metrics of the following components
Kube-scheduler
Kube-contol-manager
What Should Happen Instead?
As per this official doc: https://microk8s.io/docs/services-and-ports they run on 10259 and 10257
expectation is that able to access the metrics of scheduler and controller using standard Prometheus scrape configuration , but I am not able to.
But is not working even though my service account has cluster-admin role , when I access above ports, I am getting 403, tried with certificates also, please find below
Same goes with the Kube-scheduler also
Reproduction Steps
I have attached in the comment section to reproduce.
Introspection Report
I am not allowed to copy cluster data
Can you suggest a fix?
I am not sure but it is good to have seperate metrics for each K8s component on their own dedicated port.
Are you interested in contributing with a fix?
No, I do not have skillset
Thank you.