部署 Redis-Exporter
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-exporter
namespace: monitoring
labels:
app: redis-exporter
spec:
selector:
matchLabels:
app: redis-exporter
template:
metadata:
labels:
app: redis-exporter
spec:
containers:
- name: redis-exporter
image: bitnami/redis-exporter
args:
- "-redis.addr=10.0.1.2:6379"
- "-redis.password=123456"
---
apiVersion: v1
kind: Service
metadata:
name: redis-exporter
namespace: monitoring
labels:
app: redis-exporter
spec:
ports:
- name: api
port: 9121
targetPort: 9121
type: ClusterIP
selector:
app: redis-exporter
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app.kubernetes.io/name: redis-exporter
app.kubernetes.io/part-of: kube-prometheus
name: redis-exporter
namespace: monitoring
spec:
endpoints:
- honorLabels: true
interval: 30s
path: /metrics
port: api
scheme: http
namespaceSelector:
matchNames:
- monitoring
selector:
matchLabels:
app: redis-exporter