Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extraScrapeConfigs in prometheus-config-values.yaml #855

Merged
merged 5 commits into from
Jun 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 22 additions & 29 deletions adoc/admin-monitoring-stack.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,17 @@ cd /etc/kubernetes
kubectl --kubeconfig=admin.conf -n monitoring create secret generic etcd-certs --from-file=/etc/kubernetes/pki/etcd/ca.crt --from-file=/etc/kubernetes/pki/etcd/healthcheck-client.crt --from-file=/etc/kubernetes/pki/etcd/healthcheck-client.key
----

. Edit the configuration file `prometheus-config-values.yaml`, add `extraSecretMounts` part
. Get all etcd cluster private IP address
+
[source,bash]
----
kubectl get pods -n kube-system -l component=etcd -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
etcd-master0 1/1 Running 2 21h 192.168.0.6 master0 <none> <none>
etcd-master1 1/1 Running 2 21h 192.168.0.20 master1 <none> <none>
----

. Edit the configuration file `prometheus-config-values.yaml`, add `extraSecretMounts` and `extraScrapeConfigs` parts, change the extraScrapeConfigs targets IP address(es) as your environment and change the target numbers if you have different etcd cluster members
+
----
# Alertmanager configuration
Expand Down Expand Up @@ -1238,13 +1248,24 @@ server:
secretName: etcd-certs
readOnly: true

extraScrapeConfigs: |
- job_name: etcd
static_configs:
- targets: ['192.168.0.32:2379','192.168.0.17:2379','192.168.0.5:2379'
scheme: https
tls_config:
ca_file: /etc/secrets/ca.crt
cert_file: /etc/secrets/healthcheck-client.crt
key_file: /etc/secrets/healthcheck-client.key

## Prometheus is configured through prometheus.yml. This file and any others
## listed in serverFiles will be mounted into the server pod.
## See configuration options
## https://prometheus.io/docs/prometheus/latest/configuration/configuration/
#serverFiles:
# prometheus.yml:
----

. Upgrade prometheus helm deployment
+
[source,bash]
Expand All @@ -1253,31 +1274,3 @@ helm upgrade prometheus suse/prometheus \
--namespace monitoring \
--values prometheus-config-values.yaml
----
. First get all etcd cluster private IP address.
+
[source,bash]
----
kubectl get pods -n kube-system -l component=etcd -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
etcd-master0 1/1 Running 2 21h 192.168.0.6 master0 <none> <none>
etcd-master1 1/1 Running 2 21h 192.168.0.20 master1 <none> <none>
----
. Add new job for etcd, change the target ip address as your environment and change the target numbers if you have different etcd cluster members.
[source,bash]
+
----
kubectl edit -n monitoring configmap prometheus-server
----
+
----
scrape_configs:
- job_name: etcd
static_configs:
- targets: ['192.168.0.6:2379','192.168.0.20:2379']
scheme: https
tls_config:
ca_file: /etc/secrets/ca.crt
cert_file: /etc/secrets/healthcheck-client.crt
key_file: /etc/secrets/healthcheck-client.key
----
. Save the new configmap, the prometheus server will auto reload new configmap.