From c4d2909a77fcd4c0bcbb0c92ee37b0ab4b5b13ab Mon Sep 17 00:00:00 2001 From: Archisman Mridha Date: Thu, 8 Feb 2024 17:35:26 +0530 Subject: [PATCH] Creating pod-monitors for microservices --- .../microservices/feeds/pod-monitor.yaml | 22 +++++++++++++++++++ .../followships/pod-monitor.yaml | 22 +++++++++++++++++++ .../microservices/gateway/pod-monitor.yaml | 22 +++++++++++++++++++ .../microservices/kustomization.yaml | 6 +++++ .../microservices/posts/pod-monitor.yaml | 22 +++++++++++++++++++ .../microservices/profiles/pod-monitor.yaml | 22 +++++++++++++++++++ .../microservices/users/pod-monitor.yaml | 22 +++++++++++++++++++ 7 files changed, 138 insertions(+) create mode 100644 kubernetes/manifests/microservices/feeds/pod-monitor.yaml create mode 100644 kubernetes/manifests/microservices/followships/pod-monitor.yaml create mode 100644 kubernetes/manifests/microservices/gateway/pod-monitor.yaml create mode 100644 kubernetes/manifests/microservices/posts/pod-monitor.yaml create mode 100644 kubernetes/manifests/microservices/profiles/pod-monitor.yaml create mode 100644 kubernetes/manifests/microservices/users/pod-monitor.yaml diff --git a/kubernetes/manifests/microservices/feeds/pod-monitor.yaml b/kubernetes/manifests/microservices/feeds/pod-monitor.yaml new file mode 100644 index 0000000..239a4f5 --- /dev/null +++ b/kubernetes/manifests/microservices/feeds/pod-monitor.yaml @@ -0,0 +1,22 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: feeds-microservice-metrics + namespace: prometheus + +spec: + namespaceSelector: + matchNames: + - microservices + selector: + matchLabels: + microservice: feeds-microservice + + # Defines the labels which are transferred from the associated Kubernetes Pod object onto the + # ingested metrics. + podTargetLabels: + - microservice + + # List of endpoints part of this PodMonitor. + podMetricsEndpoints: + - port: metrics diff --git a/kubernetes/manifests/microservices/followships/pod-monitor.yaml b/kubernetes/manifests/microservices/followships/pod-monitor.yaml new file mode 100644 index 0000000..9c2d9a8 --- /dev/null +++ b/kubernetes/manifests/microservices/followships/pod-monitor.yaml @@ -0,0 +1,22 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: followships-microservice-metrics + namespace: prometheus + +spec: + namespaceSelector: + matchNames: + - microservices + selector: + matchLabels: + microservice: followships-microservice + + # Defines the labels which are transferred from the associated Kubernetes Pod object onto the + # ingested metrics. + podTargetLabels: + - microservice + + # List of endpoints part of this PodMonitor. + podMetricsEndpoints: + - port: metrics diff --git a/kubernetes/manifests/microservices/gateway/pod-monitor.yaml b/kubernetes/manifests/microservices/gateway/pod-monitor.yaml new file mode 100644 index 0000000..3457bd2 --- /dev/null +++ b/kubernetes/manifests/microservices/gateway/pod-monitor.yaml @@ -0,0 +1,22 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: gateway-microservice-metrics + namespace: prometheus + +spec: + namespaceSelector: + matchNames: + - microservices + selector: + matchLabels: + microservice: gateway-microservice + + # Defines the labels which are transferred from the associated Kubernetes Pod object onto the + # ingested metrics. + podTargetLabels: + - microservice + + # List of endpoints part of this PodMonitor. + podMetricsEndpoints: + - port: metrics diff --git a/kubernetes/manifests/microservices/kustomization.yaml b/kubernetes/manifests/microservices/kustomization.yaml index 9599194..65a766f 100644 --- a/kubernetes/manifests/microservices/kustomization.yaml +++ b/kubernetes/manifests/microservices/kustomization.yaml @@ -3,18 +3,24 @@ resources: - users/application.yaml - users/sealed-secret.yaml + - users/pod-monitor.yaml - profiles/application.yaml - profiles/sealed-secret.yaml + - profiles/pod-monitor.yaml - followships/application.yaml - followships/sealed-secret.yaml + - followships/pod-monitor.yaml - posts/application.yaml - posts/sealed-secret.yaml + - posts/pod-monitor.yaml - feeds/application.yaml - feeds/sealed-secret.yaml + - feeds/pod-monitor.yaml - gateway/application.yaml - gateway/sealed-secret.yaml + - gateway/pod-monitor.yaml diff --git a/kubernetes/manifests/microservices/posts/pod-monitor.yaml b/kubernetes/manifests/microservices/posts/pod-monitor.yaml new file mode 100644 index 0000000..dcc9ebc --- /dev/null +++ b/kubernetes/manifests/microservices/posts/pod-monitor.yaml @@ -0,0 +1,22 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: posts-microservice-metrics + namespace: prometheus + +spec: + namespaceSelector: + matchNames: + - microservices + selector: + matchLabels: + microservice: posts-microservice + + # Defines the labels which are transferred from the associated Kubernetes Pod object onto the + # ingested metrics. + podTargetLabels: + - microservice + + # List of endpoints part of this PodMonitor. + podMetricsEndpoints: + - port: metrics diff --git a/kubernetes/manifests/microservices/profiles/pod-monitor.yaml b/kubernetes/manifests/microservices/profiles/pod-monitor.yaml new file mode 100644 index 0000000..7793991 --- /dev/null +++ b/kubernetes/manifests/microservices/profiles/pod-monitor.yaml @@ -0,0 +1,22 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: profiles-microservice-metrics + namespace: prometheus + +spec: + namespaceSelector: + matchNames: + - microservices + selector: + matchLabels: + microservice: profiles-microservice + + # Defines the labels which are transferred from the associated Kubernetes Pod object onto the + # ingested metrics. + podTargetLabels: + - microservice + + # List of endpoints part of this PodMonitor. + podMetricsEndpoints: + - port: metrics diff --git a/kubernetes/manifests/microservices/users/pod-monitor.yaml b/kubernetes/manifests/microservices/users/pod-monitor.yaml new file mode 100644 index 0000000..b9a7162 --- /dev/null +++ b/kubernetes/manifests/microservices/users/pod-monitor.yaml @@ -0,0 +1,22 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: users-microservice-metrics + namespace: prometheus + +spec: + namespaceSelector: + matchNames: + - microservices + selector: + matchLabels: + microservice: users-microservice + + # Defines the labels which are transferred from the associated Kubernetes Pod object onto the + # ingested metrics. + podTargetLabels: + - microservice + + # List of endpoints part of this PodMonitor. + podMetricsEndpoints: + - port: metrics