| # |
| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you 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 |
| # |
| # http://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: ConfigMap |
| metadata: |
| name: prometheus-config |
| data: |
| # Include prometheus configuration file, setup to monitor all the |
| # Kubernetes pods the the "scrape=true" annotation. |
| prometheus.yml: | |
| global: |
| scrape_interval: 15s |
| scrape_configs: |
| - job_name: 'prometheus' |
| static_configs: |
| - targets: ['localhost:9090'] |
| - job_name: 'kubernetes-pods' |
| kubernetes_sd_configs: |
| - role: pod |
| |
| relabel_configs: |
| - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape] |
| action: keep |
| regex: true |
| - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path] |
| action: replace |
| target_label: __metrics_path__ |
| regex: (.+) |
| - source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port] |
| action: replace |
| regex: ([^:]+)(?::\d+)?;(\d+) |
| replacement: $1:$2 |
| target_label: __address__ |
| - action: labelmap |
| regex: __meta_kubernetes_pod_label_(.+) |
| - source_labels: [__meta_kubernetes_namespace] |
| action: replace |
| target_label: kubernetes_namespace |
| - source_labels: [__meta_kubernetes_pod_label_component] |
| action: replace |
| target_label: job |
| - source_labels: [__meta_kubernetes_pod_name] |
| action: replace |
| target_label: kubernetes_pod_name |
| |
| --- |
| |
| apiVersion: apps/v1beta1 |
| kind: Deployment |
| metadata: |
| name: prometheus |
| spec: |
| replicas: 1 |
| template: |
| metadata: |
| labels: |
| app: pulsar |
| component: prometheus |
| spec: |
| containers: |
| - name: prometheus |
| image: prom/prometheus:v1.6.3 |
| volumeMounts: |
| - name: config-volume |
| mountPath: /etc/prometheus |
| - name: data-volume |
| mountPath: /prometheus |
| ports: |
| - containerPort: 9090 |
| volumes: |
| - name: config-volume |
| configMap: |
| name: prometheus-config |
| - name: data-volume |
| emptyDir: {} |
| |
| --- |
| |
| apiVersion: v1 |
| kind: Service |
| metadata: |
| name: prometheus |
| labels: |
| app: pulsar |
| component: prometheus |
| spec: |
| ports: |
| - port: 9090 |
| name: server |
| clusterIP: None |
| selector: |
| app: pulsar |
| component: prometheus |
| |
| |
| --- |
| ## GRAFANA |
| |
| apiVersion: apps/v1beta1 |
| kind: Deployment |
| metadata: |
| name: grafana |
| spec: |
| replicas: 1 |
| template: |
| metadata: |
| labels: |
| app: pulsar |
| component: grafana |
| spec: |
| containers: |
| - name: grafana |
| image: apachepulsar/pulsar-grafana:latest |
| ports: |
| - containerPort: 9090 |
| env: |
| - name: PROMETHEUS_URL |
| value: http://prometheus:9090/ |
| |
| --- |
| |
| apiVersion: v1 |
| kind: Service |
| metadata: |
| name: grafana |
| labels: |
| app: pulsar |
| component: grafana |
| spec: |
| ports: |
| - port: 3000 |
| name: server |
| clusterIP: None |
| selector: |
| app: pulsar |
| component: grafana |
| |
| |
| |
| --- |
| ## Include detailed Pulsar dashboard |
| |
| apiVersion: apps/v1beta1 |
| kind: Deployment |
| metadata: |
| name: pulsar-dashboard |
| spec: |
| replicas: 1 |
| template: |
| metadata: |
| labels: |
| app: pulsar |
| component: dashboard |
| spec: |
| containers: |
| - name: grafana |
| image: apachepulsar/pulsar-dashboard:latest |
| ports: |
| - containerPort: 80 |
| env: |
| - name: SERVICE_URL |
| value: http://broker:8080/ |
| |
| --- |
| |
| apiVersion: v1 |
| kind: Service |
| metadata: |
| name: pulsar-dashboard |
| labels: |
| app: pulsar |
| component: dashboard |
| spec: |
| ports: |
| - port: 80 |
| name: server |
| clusterIP: None |
| selector: |
| app: pulsar |
| component: dashboard |