-
Hi all, I have been working in my custom config for prometheus and I have a strange problem. I saw a similar discussion in (discussions/1323) but is not the same problem that I have. Thx a lot!, ...and sorry for my bad english custom-prometheus-config.yaml (my custom prometheus config file)
prometheus-prometheus.yaml (this is "origian" file in this repo.)
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I did this with an additionalScrapeConfigs model. Here is a snippet from my json:
I then crafted a simple script to help update it in the system without modifying the original prometheus.yaml to keep it cleaner.
This will take a file called prometheus-additional.yaml and has the following as an example:
I like this model since I can put in labels and stuff in there. The script once run will also reload prometheus and the new targets will eventually show up. |
Beta Was this translation helpful? Give feedback.
-
If someone has the same problem in any time, I offer my custom prometheus-prometheus.yaml file as an example. --- apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: encrypted-gp2 namespace: monitoring provisioner: kubernetes.io/aws-ebs # Only for AWS EBS allowVolumeExpansion: true parameters: type: gp2 fsType: ext4 encrypted: "true" --- kind: PersistentVolumeClaim apiVersion: v1 metadata: name: prometheus-pvc namespace: monitoring labels: prometheus: k8s annotations: prometheus.io/scrape: "true" spec: storageClassName: encrypted-gp2 accessModes: - ReadWriteOnce resources: requests: storage: 400Gi --- apiVersion: monitoring.coreos.com/v1 kind: Prometheus metadata: labels: app.kubernetes.io/component: prometheus app.kubernetes.io/instance: k8s app.kubernetes.io/name: prometheus app.kubernetes.io/part-of: kube-prometheus app.kubernetes.io/version: 2.35.0 prometheus: k8s name: k8s namespace: monitoring spec: alerting: alertmanagers: - apiVersion: v2 name: alertmanager-main namespace: monitoring port: web enableFeatures: [] externalLabels: cluster: ${cluster_name} # SUPER IMPORTANT TO USE FEDERATION image: quay.io/prometheus/prometheus:v2.35.0 nodeSelector: kubernetes.io/os: linux podMetadata: labels: app.kubernetes.io/component: prometheus app.kubernetes.io/instance: k8s app.kubernetes.io/name: prometheus app.kubernetes.io/part-of: kube-prometheus app.kubernetes.io/version: 2.35.0 podMonitorNamespaceSelector: {} podMonitorSelector: {} probeNamespaceSelector: {} probeSelector: {} replicas: 1 # IMPORTANT: in aws EBS dont support more than 1 pod attached to PV () retention: 2y # IMPORTANT: retention on prometheus DB 2 years resources: requests: memory: 400Mi ruleNamespaceSelector: {} ruleSelector: matchLabels: prometheus: k8s role: alert-rules securityContext: fsGroup: 2000 runAsNonRoot: true runAsUser: 1000 serviceAccountName: prometheus-k8s additionalScrapeConfigs: #---------------- name: additional-scrape-configs # My problem: https://github.com/prometheus-operator/kube-prometheus/discussions/1713 key: prometheus-additional.yaml # The solution: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/additional-scrape-config.md serviceMonitorNamespaceSelector: {} #---------------- serviceMonitorSelector: {} version: 2.35.0 volumes: - name: prometheus-k8s-data persistentVolumeClaim: claimName: prometheus-pvc containers: - name: prometheus volumeMounts: - mountPath: /prometheus name: prometheus-k8s-data |
Beta Was this translation helpful? Give feedback.
I did this with an additionalScrapeConfigs model. Here is a snippet from my json: