1、部署exporter
redis_exporter-v1.57.0.linux-386.tar.gz
解压
tar -zxvf redis_exporter-v1.57.0.linux-386.tar.gz
启动
nohup ./redis_exporter -redis.password 111111 -web.listen-address 0.0.0.0:9122 &
访问确认启动成功
2、创建k8s对象
集群内部创建Endpoints代理外部端点
TypeScript
---
apiVersion: v1
kind: Service
metadata:
name: redis-exporter-monitor
namespace: monitor
labels:
app: redis-exporter-monitor
spec:
type: ClusterIP
ports:
- name: tcp-9122
port: 9122
protocol: TCP
targetPort: 9122
---
apiVersion: v1
kind: Endpoints
metadata:
name: redis-exporter-monitor
namespace: monitor
labels:
app: redis-exporter-monitor
side: mid
subsets:
- addresses:
- ip: {ip}
ports:
- name: tcp-9122
port: 9122
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: redis-exporter-monitor
namespace: monitor
labels:
team: hit
side: mid
spec:
selector:
matchLabels:
app: redis-exporter-monitor
namespaceSelector:
matchNames:
- monitor
endpoints:
- port: tcp-9122
path: /metrics
3、grafana模板
id:17507
关联文章:
【prometheus-operator】k8s监控集群redis
以上内容对您有帮助,请点赞支持,谢谢!