Cloud Native 5 min read

How to Deploy a Redis Exporter on Kubernetes for Prometheus Monitoring

This guide shows how to configure a Redis exporter alongside a Redis pod in Kubernetes, add Prometheus scrape annotations, apply the deployment and service manifests, and visualize metrics in Grafana, providing step‑by‑step commands, YAML examples, and screenshots of the monitoring dashboard.

Full-Stack DevOps & Kubernetes
Full-Stack DevOps & Kubernetes
Full-Stack DevOps & Kubernetes
How to Deploy a Redis Exporter on Kubernetes for Prometheus Monitoring

Overview

This article explains how to expose Redis metrics to Prometheus by deploying a redis-exporter container together with a Redis pod in a Kubernetes cluster. It covers the necessary YAML manifests, required annotations, command‑line steps, and how to import a Grafana dashboard to visualize the collected metrics.

Kubernetes Manifests

The following Deployment creates two containers in the same pod: the official Redis image and the oliver006/redis_exporter sidecar.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: redis
  namespace: kube-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: redis
  template:
    metadata:
      labels:
        app: redis
    spec:
      containers:
      - name: redis
        image: redis:4
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
        ports:
        - containerPort: 6379
      - name: redis-exporter
        image: oliver006/redis_exporter:latest
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
        ports:
        - containerPort: 9121
---
kind: Service
apiVersion: v1
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

The Service adds two ports: the standard Redis port (6379) and the exporter port (9121). The annotations prometheus.io/scrape="true" and prometheus.io/port="9121" tell Prometheus to scrape metrics from this service automatically.

Applying the Configuration

After saving the above content to redis.yaml, apply it with: kubectl apply -f redis.yaml This creates the pod with both containers and the service with the proper annotations. If you modify the file later, re‑run the same command to update the resources.

Grafana Dashboard

To visualize the Redis metrics, import the provided Grafana dashboard JSON file named Redis Cluster-1571393212519.json. The file can be downloaded from the following Baidu Pan link (extraction code: gayx).

After importing, the Grafana UI will display charts such as CPU usage, memory consumption, and Redis command statistics, confirming that the exporter is correctly exposing metrics.

Resulting Monitoring View

The following screenshot shows the Grafana dashboard after the exporter is scraped by Prometheus:

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

monitoringKubernetesRedisYAMLExporter
Full-Stack DevOps & Kubernetes
Written by

Full-Stack DevOps & Kubernetes

Focused on sharing DevOps, Kubernetes, Linux, Docker, Istio, microservices, Spring Cloud, Python, Go, databases, Nginx, Tomcat, cloud computing, and related technologies.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.