apiVersion: apps/v1
kind: Deployment
metadata:
  name: pushgateway
  labels:
    app: pushgateway
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pushgateway
  template:
    metadata:
      labels:
        app: pushgateway
    spec:
      containers:
        - image: docker.io/prom/pushgateway:v1.6.2
          name: pushgateway
          ports:
            - containerPort: 9091
---
apiVersion: v1
kind: Service
metadata:
  name: pushgateway
  labels:
    app: pushgateway
spec:
  ports:
    - name: pushgateway
      port: 9091
      protocol: TCP
      targetPort: 9091
  selector:
    app: pushgateway
  type: ClusterIP
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: k8up-pushgateway
spec:
  endpoints:
  - interval: 60s
    port: pushgateway
  selector:
    matchLabels:
      app: pushgateway