创建redis Pod
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
namespace: kube-system
annotations:
prometheus.io/scrape: 'true'
spec:
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: docker.io/library/redis:latest
imagePullPolicy: IfNotPresent
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6397
- name: redis-exporter
image: docker.io/oliver006/redis_exporter
imagePullPolicy: IfNotPresent
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 9121
创建service
apiVersion: v1
kind: Service
metadata:
name: redis
namespace: kube-system
annotations:
prometheus.io/scrape: 'true'
prometheus.io/port: '9121'
spec:
selector:
app: redis
ports:
- name: redis
port: 6379
targetPort: 6379
- name: prom
port: 9121
targetPort: 9121