环境(安装过程见基于containerd的k8s部署)
序号 | 主机名 | 系统版本 | k8s版本 | 备注 |
1 | master:192.168.3.114 | rockylinux8.6 | 基于containerd的1.25.0 | |
2 | node1:192.168.3.115 | rockylinux8.6 | 基于containerd的1.25.0 | |
3 | node2:192.168.3.116 | rockylinux8.6 | 基于containerd的1.25.0 |
一、监控
1、安装node-export
yaml 文件如下
kubectl create ns monitor
kubectl describe nodes master | grep Taints
vim node-export.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: node-exporter
namespace: monitor
labels:
name: node-exporter
spec:
selector:
matchLabels:
name: node-exporter
template:
metadata:
labels:
name: node-exporter
spec:
hostPID: true
hostIPC: true
hostNetwork: true
containers:
- name: node-exporter
image: bitnami/node-exporter:1.4.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9100
resources:
requests:
cpu: 0.15
securityContext:
privileged: true
args:
- --path.procfs
- /host/proc
- --path.sysfs
- /host/sys
- --collector.filesystem.ignored-mount-points
- '"^/(sys|proc|dev|host|etc)($|/)"'
volumeMounts:
- name: dev
mountPath: /host/dev
- name: proc
mountPath: /host/proc
- name: sys
mountPath: /host/sys
- name: rootfs
mountPath: /rootfs
tolerations:
- key: "node-role.kubernetes.io/control-plane"
operator: "Exists"
effect: "NoSchedule"
volumes:
- name: proc
hostPath:
path: /proc
- name: dev
hostPath:
path: /dev
- name: sys
hostPath:
path: /sys
- name: rootfs
hostPath:
path: /
注: tolerations:
- key: "node-role.kubernetes.io/control-plane"
kubectl get pods -n monitor