本文作者:丁辉
N9e对接Kube-Prometheus-Stack
更新Kube-Prometheus-Stack
编写 values.yaml
1
vi kube-prometheus-stack-values.yaml
内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45prometheusOperator:
admissionWebhooks:
patch:
enabled: true
image:
registry: registry.aliyuncs.com # 配置国内镜像加速
repository: google_containers/kube-webhook-certgen
grafana:
enabled: false
alertmanager:
enabled: false
defaultRules:
create: false
# 这些设置表明所提及的选择器(规则、服务监视器、Pod 监视器和抓取配置)将具有独立的配置,而不会基于 Helm 图形值。(否则你的 ServiceMonitor 可能不会被自动发现)
prometheus:
prometheusSpec:
ruleSelectorNilUsesHelmValues: false
serviceMonitorSelectorNilUsesHelmValues: false
podMonitorSelectorNilUsesHelmValues: false
probeSelectorNilUsesHelmValues: false
scrapeConfigSelectorNilUsesHelmValues: false
# 服务器上启用 --web.enable-remote-write-receiver 标志
enableRemoteWriteReceiver: true
# 启用 Prometheus 中被禁用的特性
enableFeatures:
- remote-write-receiver
# 挂载持久化存储
storageSpec:
volumeClaimTemplate:
spec:
# 选择默认的 sc 创建存储(我已在集群内准备 nfs-client)
storageClassName:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 10Gi # 根据自己的需求申请 pvc 大小
# 挂载本地时区
volumes:
- name: timezone
hostPath:
path: /usr/share/zoneinfo/Asia/Shanghai
volumeMounts:
- name: timezone
mountPath: /etc/localtime
readOnly: true更新
1
helm upgrade kube-prometheus-stack -f kube-prometheus-stack-values.yaml --set "kube-state-metrics.image.registry=k8s.dockerproxy.com" prometheus-community/kube-prometheus-stack -n monitor
更新N9e
获取 nightingale-center svc
1
kubectl get svc nightingale-center -n monitor | grep -v NAME | awk '{print $3}'
编写 values.yaml
1
vi n9e-values.yaml
内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26expose:
type: clusterIP # 使用 clusterIP
externalURL: https://hello.n9e.info # 改为自己的外部服务访问地址
persistence:
enabled: true
categraf:
internal:
docker_socket: unix:///var/run/docker.sock # 如果您的kubernetes运行时是容器或其他,则清空此变量。
n9e:
internal:
image:
repository: flashcatcloud/nightingale
tag: latest # 使用最新版镜像
prometheus:
type: external
external:
host: "10.43.119.105" # 这里添加 nightingale-center svc
port: "9090"
username: ""
password: ""
podAnnotations: {}更新
1
helm upgrade nightingale ./n9e-helm -n monitor -f n9e-values.yaml
编写 ServiceMonitor
1
vi n9e-servicemonitor.yaml
内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: n9e-center-monitor
namespace: monitor
spec:
endpoints:
- path: /metrics
port: port
namespaceSelector:
matchNames:
- monitor
selector:
matchLabels:
app: n9e部署
1
kubectl apply -f n9e-servicemonitor.yaml
N9e 添加数据源
1
http://kube-prometheus-stack-prometheus:9090/
问题记录
1
2 WARNING writer/writer.go:129 push data with remote write:http://10.43.119.105:9090/api/v1/write request got status code: 400, response body: out of order sample
WARNING writer/writer.go:79 post to http://10.43.119.105:9090/api/v1/write got error: push data with remote write:http://10.43.119.105:9090/api/v1/write request got status code: 400, response body: out of order sample上报数据 400, 暂时没有思路咋解决
I'm so cute. Please give me money.
- 本文链接: https://blog.offends.cn/Kubernetes/Helm/N9e对接Kube-Prometheus-Stack.html
- 版权声明: 本博客所有文章除特别声明外,均默认采用 CC BY-NC-SA 4.0 许可协议。