Open y4h2 opened 2 years ago
# The relabeling allows the actual pod scrape endpoint to be configured via the
# following annotations:
#
# * `prometheus.io/scrape`: Only scrape pods that have a value of `true`
# * `prometheus.io/path`: If the metrics path is not `/metrics` override this.
# * `prometheus.io/port`: Scrape the pod on the indicated port instead of the
prometheus本身也是一个time series database
配置项
Remote Storage integrations
working prometheus with connection to google monitoring with istio injection.
YAML detail
```yaml # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. apiVersion: v1 kind: Service apiVersion: v1 metadata: labels: name: prometheus name: prometheus spec: selector: app: prometheus type: ClusterIP ports: - name: prometheus protocol: TCP port: 9090 --- apiVersion: v1 kind: Deployment apiVersion: apps/v1 metadata: labels: app: prometheus name: prometheus spec: replicas: 1 selector: matchLabels: app: prometheus template: metadata: name: prometheus labels: app: prometheus annotations: prometheus.io/scrape: 'true' spec: # Needed when using unmodified rbac-setup.yml serviceAccountName: prometheus containers: - name: prometheus image: gcr.io/stackdriver-prometheus/stackdriver-prometheus:release-0.4.1 # Uncomment this to enable debug logs. Can be very verbose. #args: ["--config.file=/etc/prometheus/prometheus.yml", "--log.level=debug"] # Helps during development, when reusing the tag. imagePullPolicy: Always ports: - name: web containerPort: 9090 volumeMounts: - name: config-volume mountPath: /etc/prometheus volumes: - name: config-volume configMap: name: prometheus --- apiVersion: v1 kind: ConfigMap apiVersion: v1 data: prometheus.yml: | # Source: https://github.com/stackdriver/prometheus/blob/master/documentation/examples/prometheus.yml global: external_labels: _stackdriver_project_id: 'kbxplay1' _kubernetes_cluster_name: 'dev4' _kubernetes_location: 'us-central1' # Scrape config for nodes (kubelet). # # Rather than connecting directly to the node, the scrape is proxied though the # Kubernetes apiserver. This means it will work if Prometheus is running out of # cluster, or can't connect to nodes for some other reason (e.g. because of # firewalling). scrape_configs: - job_name: 'kubernetes-nodes' # Default to scraping over https. If required, just disable this or change to # `http`. scheme: https # This TLS & bearer token file config is used to connect to the actual scrape # endpoints for cluster components. This is separate to discovery auth # configuration because discovery & scraping are two separate concerns in # Prometheus. The discovery auth config is automatic if Prometheus runs inside # the cluster. Otherwise, more config options have to be provided within the #