Prometheus Pushgateway Installation: Difference between revisions
Jump to navigation
Jump to search
Line 3: | Line 3: | ||
=Kubernetes Installation= | =Kubernetes Installation= | ||
==Overview= | |||
Deploy the pod and associated services, and then configure it as a scraping target by deploying a ServiceMonitor. All descriptors are available in: | Deploy the pod and associated services, and then configure it as a scraping target by deploying a ServiceMonitor. All descriptors are available in: | ||
{{External|[https://github.com/ovidiuf/playground/tree/master/prometheus/pushgateway playground/prometheus/pushgateway]}} | {{External|[https://github.com/ovidiuf/playground/tree/master/prometheus/pushgateway playground/prometheus/pushgateway]}} | ||
==Pod and Services== | |||
<syntaxhighlight lang='yaml'> | <syntaxhighlight lang='yaml'> | ||
Line 50: | Line 53: | ||
targetPort: 9091 | targetPort: 9091 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==ServiceMonitor== | |||
Expose it then as a Prometheus scraping [[Prometheus_Concepts#Target|target]] with a [[Prometheus_Operator_Concepts#ServiceMonitor_Resource|ServiceMonitor]]: | Expose it then as a Prometheus scraping [[Prometheus_Concepts#Target|target]] with a [[Prometheus_Operator_Concepts#ServiceMonitor_Resource|ServiceMonitor]]: | ||
<syntaxhighlight lang='yaml'> | <syntaxhighlight lang='yaml'> |
Revision as of 03:26, 16 October 2020
Internal
Kubernetes Installation
=Overview
Deploy the pod and associated services, and then configure it as a scraping target by deploying a ServiceMonitor. All descriptors are available in:
Pod and Services
apiVersion: v1
kind: Pod
metadata:
name: 'pushgateway'
labels:
function: 'pushgateway'
spec:
containers:
- name: 'pushgateway'
image: prom/pushgateway
---
apiVersion: v1
kind: Service
metadata:
name: 'pushgateway'
labels:
function: 'pushgateway-target'
spec:
type: 'ClusterIP'
selector:
function: 'pushgateway'
ports:
# 'name' is important, it will be referred by ServiceMonitor configuration
- name: 'pushgateway'
protocol: 'TCP'
port: 9091
targetPort: 9091
---
apiVersion: v1
kind: Service
metadata:
name: 'pushgateway-lb'
spec:
type: 'LoadBalancer'
selector:
function: 'pushgateway'
ports:
- name: 'pushgateway'
protocol: 'TCP'
port: 9091
targetPort: 9091
ServiceMonitor
Expose it then as a Prometheus scraping target with a ServiceMonitor:
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: pushgateway
namespace: prometheus
labels:
release: prometheus
spec:
endpoints:
- port: 'pushgateway' # must match the label from Service declaration
path: /metrics
interval: 15s
namespaceSelector:
matchNames:
- prometheus
selector:
matchLabels:
function: 'pushgateway-target'
Also see: