Skip to content

Instantly share code, notes, and snippets.

@arajkumar
Created March 23, 2022 07:53
Show Gist options
  • Select an option

  • Save arajkumar/7b3eaa8c21e6d74e8e0d7eaa7962af75 to your computer and use it in GitHub Desktop.

Select an option

Save arajkumar/7b3eaa8c21e6d74e8e0d7eaa7962af75 to your computer and use it in GitHub Desktop.
OCP UWM Monitoring with example app
apiVersion: v1
kind: ConfigMap
metadata:
name: cluster-monitoring-config
namespace: openshift-monitoring
data:
config.yaml: |
enableUserWorkload: true
---
apiVersion: v1
kind: Namespace
metadata:
name: ns1
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: prometheus-example-app
name: prometheus-example-app
namespace: ns1
spec:
replicas: 2
selector:
matchLabels:
app: prometheus-example-app
template:
metadata:
labels:
app: prometheus-example-app
spec:
containers:
- image: ghcr.io/rhobs/prometheus-example-app:0.3.0
imagePullPolicy: IfNotPresent
name: prometheus-example-app
---
apiVersion: v1
kind: Service
metadata:
labels:
app: prometheus-example-app
name: prometheus-example-app
namespace: ns1
spec:
ports:
- port: 8080
protocol: TCP
targetPort: 8080
name: web
selector:
app: prometheus-example-app
type: ClusterIP
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: prometheus-example-monitor
namespace: ns1
labels:
team: kind
spec:
endpoints:
- interval: 5s
port: web
selector:
matchLabels:
app: prometheus-example-app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment