Procházet zdrojové kódy

add alerting stuff

Grega Bremec před 7 měsíci
rodič
revize
2ee7931030

+ 63 - 0
labs/monitoring/alerts/frontend.yaml

@@ -0,0 +1,63 @@
+apiVersion: v1
+kind: List
+metadata: {}
+items:
+- apiVersion: apps/v1
+  kind: Deployment
+  metadata:
+    creationTimestamp: null
+    labels:
+      app: frontend
+    name: frontend
+  spec:
+    replicas: 10
+    selector:
+      matchLabels:
+        app: frontend
+    strategy: {}
+    template:
+      metadata:
+        creationTimestamp: null
+        labels:
+          app: frontend
+      spec:
+        containers:
+        - image: registry.ocp4.example.com:8443/redhattraining/hello-world-nginx:v1.0
+          name: hello-world-nginx
+          resources:
+            requests:
+              cpu: 50m
+              memory: 20Mi
+  status: {}
+- apiVersion: v1
+  kind: Service
+  metadata:
+    creationTimestamp: null
+    labels:
+      app: frontend
+    name: frontend
+  spec:
+    ports:
+    - port: 8080
+      protocol: TCP
+      targetPort: 8080
+    selector:
+      app: frontend
+  status:
+    loadBalancer: {}
+- apiVersion: route.openshift.io/v1
+  kind: Route
+  metadata:
+    creationTimestamp: null
+    labels:
+      app: frontend
+    name: frontend
+  spec:
+    port:
+      targetPort: 8080
+    to:
+      kind: ""
+      name: frontend
+      weight: null
+  status:
+    ingress: null

+ 26 - 0
labs/monitoring/alerts/python-app.yaml

@@ -0,0 +1,26 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  creationTimestamp: null
+  labels:
+    app: python-app
+  name: python-app
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: python-app
+  strategy: {}
+  template:
+    metadata:
+      creationTimestamp: null
+      labels:
+        app: python-app
+    spec:
+      containers:
+      - image: registry.ocp4.example.com:8443/redhattraining/python-load:v0.1
+        name: python-app
+        resources:
+          requests:
+              cpu: 100m
+              memory: 50Mi

+ 7 - 0
labs/monitoring/alerts/traffic-simulator.sh

@@ -0,0 +1,7 @@
+#! /bin/bash
+
+while true;
+do
+    curl http://frontend-monitoring-alerts.apps.ocp4.example.com/?[1-100] > /dev/null & curl http://exoplanets.apps.ocp4.example.com/?[1-100] > /dev/null
+    sleep 10
+done

+ 10 - 0
playbooks/alerts-start.yml

@@ -47,4 +47,14 @@
         api_version: v1
         kind: namespace
         name: "{{ ge_nsp }}"
+
+    - name: Deploy the sample app manifests
+      k8s:
+        kubeconfig: tmp/kubeconfig-ocp4
+        validate_certs: no
+        namespace: "{{ ge_nsp }}"
+        src: ../labs/monitoring/alerts/{{ item }}
+      loop:
+        - frontend.yaml
+        - exoplanets.yaml
 ...