diff --git a/deploy/cloud/manifests/db-metrics.yaml b/deploy/cloud/manifests/db-metrics.yaml new file mode 100644 index 00000000000..1ce223e654a --- /dev/null +++ b/deploy/cloud/manifests/db-metrics.yaml @@ -0,0 +1,83 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + app: database-monitor + name: database-monitor-config + namespace: sealos +data: + config.yml: | + server: + addr: ":9090" +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: database-monitor + name: database-monitor-deployment + namespace: sealos +spec: + replicas: 1 + selector: + matchLabels: + app: database-monitor + strategy: + type: Recreate + template: + metadata: + labels: + app: database-monitor + spec: + containers: + - args: + - /config/config.yml + command: + - /manager + env: + - name: PROMETHEUS_SERVICE_HOST + value: http://kb-addon-prometheus-server. + image: ghcr.io/labring/sealos-cloud-database-monitor:latest + imagePullPolicy: Always + name: database-monitor + ports: + - containerPort: 9090 + protocol: TCP + resources: + requests: + cpu: 1m + memory: 500M + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + runAsNonRoot: true + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /config + name: config-vol + dnsPolicy: ClusterFirst + restartPolicy: Always + volumes: + - configMap: + defaultMode: 420 + name: database-monitor-config + name: config-vol +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: database-monitor + name: database-monitor + namespace: sealos +spec: + ports: + - name: http + port: 9090 + protocol: TCP + targetPort: 9090 + selector: + app: database-monitor diff --git a/deploy/cloud/scripts/init.sh b/deploy/cloud/scripts/init.sh index ac83ca044a6..858272c27e4 100644 --- a/deploy/cloud/scripts/init.sh +++ b/deploy/cloud/scripts/init.sh @@ -19,6 +19,9 @@ function prepare { # apply notifications crd kubectl apply -f manifests/notifications_crd.yaml + # apply kb database metrics + kubectl apply -f manifests/db-metrics.yaml + # gen mongodb uri gen_mongodbUri