k8s-学习笔记6-prom监控
1 kube-state-metrics
https://quay.io/repository/coreos/kube-state-metrics?tab=tags

2 node-exporter
每个节点一个,使用ds部署
/proc /sys挂载进来,因为很多系统信息在这些目录里
hostNetWork: True,和宿主机共享网络名称空间,就是容器里监听的端口,实际上在宿主机上,容器自己没有ip。
3 cadvisor
下载官方文件,加了一个hostport。
https://github.com/google/cadvisor/tree/master/deploy/kubernetes
# cat base/daemonset.yaml
apiVersion: apps/v1 # for Kubernetes versions before 1.9.0 use apps/v1beta2
kind: DaemonSet
metadata:
name: cadvisor
namespace: cadvisor
annotations:
seccomp.security.alpha.kubernetes.io/pod: 'docker/default'
spec:
selector:
matchLabels:
name: cadvisor
template:
metadata:
labels:
name: cadvisor
spec:
serviceAccountName: cadvisor
containers:
- name: cadvisor
image: google/cadvisor:v0.30.2
imagePullPolicy: IfNotPresent
resources:
requests:
memory: 200Mi
cpu: 150m
limits:
memory: 2000Mi
cpu: 300m
volumeMounts:
- name: rootfs
mountPath: /rootfs
readOnly: true
- name: var-run
mountPath: /var/run
readOnly: true
- name: sys
mountPath: /sys
readOnly: true
- name: docker
mountPath: /var/lib/docker
readOnly: true
- name: disk
mountPath: /dev/disk
readOnly: true
ports:
- name: http
containerPort: 8080
hostPort: 8090
protocol: TCP
automountServiceAccountToken: false
terminationGracePeriodSeconds: 30
volumes:
- name: rootfs
hostPath:
path: /
- name: var-run
hostPath:
path: /var/run
- name: sys
hostPath:
path: /sys
- name: docker
hostPath:
path: /var/lib/docker
- name: disk
hostPath:
path: /dev/disk
kustomize base/kustomization.yaml | kubectl apply -f -
prom监控参数
https://github.com/google/cadvisor/blob/master/docs/storage/prometheus.md
4 blackbox
5 prom

浙公网安备 33010602011771号