Skip to content

Instantly share code, notes, and snippets.

@hexfusion
Forked from jcpowermac/ServiceMonitoring.yaml
Created January 20, 2021 22:23
Show Gist options
  • Save hexfusion/6c4b0be914201bf20f5a383e77c90644 to your computer and use it in GitHub Desktop.
Save hexfusion/6c4b0be914201bf20f5a383e77c90644 to your computer and use it in GitHub Desktop.
vsphere exporter in openshift (will submit pr)

Just testing https://github.com/pryorda/vmware_exporter/ out probably not the best method or locations for configurations

#!/bin/bash

oc label namespaces openshift-vsphere-infra openshift.io/cluster-monitoring=true
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: prometheus-k8s
namespace: openshift-vsphere-infra
rules:
- verbs:
- get
- list
- watch
apiGroups:
- ''
resources:
- services
- endpoints
- pods
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: prometheus-k8s
namespace: openshift-vsphere-infra
subjects:
- kind: ServiceAccount
name: prometheus-k8s
namespace: openshift-monitoring
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: prometheus-k8s
apiVersion: v1
kind: Service
metadata:
labels:
k8s-app: vmware-exporter
name: metrics
namespace: openshift-vsphere-infra
spec:
ports:
- name: vmware-metrics
port: 9272
protocol: TCP
targetPort: 9272
selector:
k8s-app: vmware-exporter
sessionAffinity: None
type: ClusterIP
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
k8s-app: vmware-exporter
name: vmware-exporter-monitor
namespace: openshift-vsphere-infra
spec:
endpoints:
- interval: 30s
port: vmware-metrics
scheme: http
jobLabel: app
namespaceSelector:
matchNames:
- openshift-vsphere-infra
selector:
matchLabels:
k8s-app: vmware-exporter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment