Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(server): support resource monitor #1468

Merged
merged 8 commits into from
Aug 22, 2023

Conversation

0fatal
Copy link
Contributor

@0fatal 0fatal commented Aug 15, 2023

export DATABASE_URL=<DATABASE_URL>

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update

# deploy prometheus
cat <<EOF > prometheus-helm.yaml
fullnameOverride: prometheus
alertmanager:
  enabled: false
grafana:
  enabled: false
coreDns:
  enabled: false
nodeExporter:
  enabled: false
kubeApiServer:
  enabled: false
kubeScheduler:
  enabled: false
kubeControllerManager:
  enabled: false
kubeEtcd:
  enabled: false
kubeProxy:
  enabled: false
kubeStateMetrics:
  enabled: false
prometheus:
  prometheusSpec:
    storageSpec:
      volumeClaimTemplate:
        spec:
          accessModes: ["ReadWriteOnce"]
          resources:
            requests:
              storage: 20Gi
  networkPolicy:
    enabled: true
    ingress:
      - from:
        - namespaceSelector:
            matchLabels:
              kubernetes.io/metadata.name: laf-system
    egress:
      - {}
EOF

helm install prometheus -n laf-system \
    -f prometheus-helm.yaml \
    prometheus-community/kube-prometheus-stack

# deploy mongodb exporter for prometheus
helm install prometheus-mongodb-exporter -n laf-system \
    --set image.tag="0.39.0"
    --set mongodb.uri=${DATABASE_URL} \
    --set serviceMonitor.enabled=true \
    --set serviceMonitor.additionalLabels.release=prometheus \
    --set serviceMonitor.additionalLabels.namespace=laf-system \
    prometheus-community/prometheus-mongodb-exporter
# enable monitor for minio

cat <<EOF > minio-cluster-probe.yaml
apiVersion: monitoring.coreos.com/v1
kind: Probe
metadata:
  annotations:
    meta.helm.sh/release-name: minio
    meta.helm.sh/release-namespace: laf-system
  labels:
    app: minio
    app.kubernetes.io/managed-by: Helm
    chart: minio-5.0.1
    heritage: Helm
    namespace: laf-system
    release: prometheus
  name: minio-cluster
  namespace: laf-system
spec:
  jobName: minio
  prober:
    path: /minio/v2/metrics/cluster
    scheme: http
    url: minio.laf-system:9000
  targets:
    staticConfig:
      static:
        - minio.laf-system
EOF

kubectl apply -f minio-cluster-probe.yaml
# update prometheus conf

db.Region.updateMany({}, {
	$set: {
            prometheusConf: {
		apiUrl: "http://prometheus-prometheus.laf-system.svc.cluster.local:9090"
	    }
	}
})

@maslow maslow merged commit 9e2c17d into labring:main Aug 22, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants