Hi Did any one tried scraping Kubernetes cluster using Prometheus hosted outside your k8 cluster?
Generated token , tested and its working .
Installed Cadvisor in our clusters along with kube-state-metrics
I am able to get the annotations and other labels associated with cluster but however the metrics part is missing for all resources (pods, containers. nodes etc)
cAdvisor and kube-state metrics are installed on the cluster which needs to be scraped.
'---------------my prometheus.yml -------
global:
scrape_interval: 60s
scrape_configs:
- job_name: ‘prometheus’
scrape_interval: 60s
static_configs:- targets: [‘localhost:9090’]
- job_name: ‘kubernetes-apiservers’
kubernetes_sd_configs:- role: endpoints
api_server: https://XXXXXXX:6443
tls_config:
insecure_skip_verify: true
bearer_token:XXXXXXXXXXXXX
scheme: https
tls_config:
insecure_skip_verify: true
bearer_token: XXXXXXXXXXXXXXXXX
relabel_configs: - source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
action: keep
regex: default;kubernetes;https
- role: endpoints
- job_name: ‘kubernetes-nodes’
scheme: https
tls_config:
insecure_skip_verify: true
bearer_token: XXXXXXXXX
kubernetes_sd_configs:- role: node
api_server: https://xxxxxxxxx:6443
tls_config:
insecure_skip_verify: true
bearer_token: XXXXXXX
relabel_configs: - action: labelmap
regex: _meta_kubernetes_node_label(.+) - target_label: address
replacement: kubernetes.default.svc:443 - source_labels: [__meta_kubernetes_node_name]
regex: (.+)
target_label: metrics_path
replacement: /api/v1/nodes/$1/proxy/metrics
- role: node
Any suggestions are welcome , thanks (edited)