Skip to content

Commit

Permalink
added services + serviceMonitor
Browse files Browse the repository at this point in the history
  • Loading branch information
dhrumilpatel committed Dec 29, 2021
1 parent e538a1b commit 2bc9a22
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
16 changes: 16 additions & 0 deletions k8s/mongodb-headless-svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: mongodb-headless
namespace: database
spec:
type: ClusterIP
clusterIP: None
publishNotReadyAddresses: true
ports:
- name: mongodb
port: 27017
targetPort: mongodb
selector:
app.kubernetes.io/name: mongodb
app.kubernetes.io/component: mongodb
17 changes: 17 additions & 0 deletions k8s/monogodb-metrics-svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: mongodb-metrics
namespace: database
labels:
app.kubernetes.io/name: mongodb
spec:
type: ClusterIP
ports:
- port: 9216
targetPort: metrics
protocol: TCP
name: http-metrics
selector:
app.kubernetes.io/name: mongodb
app.kubernetes.io/component: mongodb
17 changes: 17 additions & 0 deletions k8s/monogodb-servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: mongodb
namespace: monitoring
labels:
team: devops-by-example
spec:
endpoints:
- port: http-metrics
interval: 30s
namespaceSelector:
matchNames:
- database
selector:
matchLabels:
app.kubernetes.io/name: mongodb

0 comments on commit 2bc9a22

Please sign in to comment.