Created
August 3, 2022 18:04
-
-
Save vikram-raj/dd1c49b83c8a65a4bdf2239217a17542 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: cluster-monitoring-config | |
namespace: openshift-monitoring | |
data: | |
config.yaml: | | |
enableUserWorkload: true | |
--- | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: user-workload-monitoring-config | |
namespace: openshift-user-workload-monitoring | |
data: | |
config.yaml: | | |
prometheusUserWorkload: | |
replicas: 1 | |
--- | |
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
name: ns2 | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
labels: | |
app: prometheus-example-app | |
name: prometheus-example-app | |
namespace: ns2 | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: prometheus-example-app | |
template: | |
metadata: | |
labels: | |
app: prometheus-example-app | |
spec: | |
containers: | |
- image: quay.io/brancz/prometheus-example-app:v0.1.0 | |
imagePullPolicy: IfNotPresent | |
name: prometheus-example-app | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
labels: | |
app: prometheus-example-app | |
name: prometheus-example-app | |
namespace: ns2 | |
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: | |
labels: | |
k8s-app: prometheus-example-monitor | |
name: prometheus-example-monitor | |
namespace: ns2 | |
spec: | |
endpoints: | |
- interval: 30s | |
port: web | |
scheme: http | |
selector: | |
matchLabels: | |
app: prometheus-example-app | |
--- | |
apiVersion: monitoring.coreos.com/v1 | |
kind: PrometheusRule | |
metadata: | |
name: example-alert | |
namespace: ns2 | |
spec: | |
groups: | |
- name: example | |
rules: | |
- record: VersionRule | |
expr: version{job="prometheus-example-app"} | |
- alert: VersionAlert | |
expr: version{job="prometheus-example-app"} == 0 | |
for: 1s | |
labels: | |
severity: warning |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment