查看prometheus
kubectl get prometheus k8s -n kubesphere-monitoring-system -o yaml
添加 http://172.31.115.19:8480/insert/0/prometheus/api/v1/write , 使prometheus 数据传输到远程 VictoriaMetrics 存储
apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
name: k8s
namespace: kubesphere-monitoring-system
spec:
additionalScrapeConfigs:
key: prometheus-additional.yaml
name: additional-scrape-configs
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- preference:
matchExpressions:
- key: node-role.kubernetes.io/monitoring
operator: Exists
weight: 100
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: prometheus
operator: In
values:
- k8s
namespaces:
- kubesphere-monitoring-system
topologyKey: kubernetes.io/hostname
weight: 100
alerting:
alertmanagers:
- name: alertmanager-main
namespace: kubesphere-monitoring-system
port: web
image: 192.168.15.198/prom/prometheus:v2.20.1
remoteWrite:
- url: http://172.31.115.19:8480/insert/0/prometheus/api/v1/write
nodeSelector:
kubernetes.io/os: linux
podMonitorNamespaceSelector: {}
podMonitorSelector: {}
query:
maxConcurrency: 1000
replicas: 2
resources:
limits:
cpu: "4"
memory: 16Gi
requests:
cpu: 200m
memory: 400Mi
retention: 7d
ruleSelector:
matchLabels:
prometheus: k8s
role: alert-rules
scrapeInterval: 1m
securityContext:
fsGroup: 0
runAsNonRoot: false
runAsUser: 0
serviceAccountName: prometheus-k8s
serviceMonitorNamespaceSelector: {}
serviceMonitorSelector: {}
storage:
volumeClaimTemplate:
spec:
resources:
requests:
storage: 20Gi
storageClassName: nfs-storage
tolerations:
- effect: NoSchedule
key: dedicated
operator: Equal
value: monitoring
version: v2.20.1