Reputation:
I have Prometheus working as a docker image. My source is :
spec:
containers:
- name: prometheus
image: quay.io/coreos/prometheus
The config that is working with this version of Prometheus is :
global:
scrape_interval: 5s
scrape_configs:
- job_name: 'kubernetes_apiserver'
tls_config:
insecure_skip_verify: true
kubernetes_sd_configs:
- api_servers:
- http://172.29.219.102:8080
role: apiserver
relabel_configs:
- source_labels: [__meta_kubernetes_role]
action: keep
regex: (?:apiserver)
- job_name: 'docker_containers'
metrics_path: '/metrics'
tls_config:
insecure_skip_verify: true
static_configs:
- targets:
- 172.29.219.103:4194
- 172.29.219.104:4194
- 172.29.219.105:4194
- job_name: 'kubernetes_pods'
tls_config:
insecure_skip_verify: true
kubernetes_sd_configs:
- api_servers:
- http://172.29.219.102:8080
role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_name]
action: replace
target_label: pod_name
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
action: replace
target_label: __metrics_path__
regex: (.+)
Now I downloaded the latest version of Prometheus (v2.0.0) (standalone deployment on VM and NOT a docker image )and when I try to launch the same config in that version, I get the below ERROR.
caller=main.go:356 msg="Error loading config" err="couldn't load configuration (--config.file=/etc/prometheus-2.0.0.linux-amd64/prometheus.yml): Unknown... role \"apiserver\""
Does anyone know why one configuration is compatible with one version of Prometheus and not the other ?
Upvotes: 1
Views: 166
Reputation: 34192
The removal of the apiserver
role was back in 1.3.0, from the release email:
the apiserver role was dropped as it was just a static configuration of the provided API server. Instead, the generically available kubernetes service should be used in the endpoint discovery
There were no changes in kubernetes service discovery for 2.0.
Upvotes: 0
Reputation: 21155
1.x to 2.0 is a pretty big bump, and you should expect some backwards-incompatible changes.
You can find details about breaking/important changes in the migration guide.
Details of the kubernetes_sd_configs
are available for 2.0 and 1.8.
Also, please note the warning in the kubernetes_sd_configs section, it pretty much spells out that changes may occur even between minor versions.
Kubernetes SD is in beta: breaking changes to configuration are still likely in future releases.
Upvotes: 1