Skip to main content
Version: Cloud

Monitor Redis DB in Kubernetes

Overview

Redis running in kubernetes can be monitored in SnappyFlow using following steps.

Redis monitoring with sfKubeAgent

sfKubeAgent is run as a sidecar with the configMap shown below. The config map instantiates plugins for metrics.

apiVersion: v1
kind: ConfigMap
metadata:
name: redis-config-map
data:
redis-config: |
maxmemory 2mb
maxmemory-policy allkeys-lru
cluster-enabled yes
config.yaml: |-
key: <profile_key>
metrics:
plugins:
- name: kube-sfagent-redisdb
enabled: true
interval: 30
config:
documentsTypes:
- keyspaceStat
- redisDetails
- redisPersistenc
- redisStat
- slowLogs
password: "a-very-complex-password-here"
port: 6379
user: "admin"

The example of Redis pod with redis cluster and sfKubeAgent containers is shown below

you can change redis container version and configuration based on customer usecase

apiVersion: v1
kind: Pod
metadata:
name: redis
labels:
snappyflow/appname: <app_name>
snappyflow/projectname: <project_name>
spec:
containers:
- name: redis
image: redis:5.0.4
command:
- redis-server
- "/redis-master/redis.conf"
env:
- name: MASTER
value: "true"
ports:
- containerPort: 6379
resources:
limits:
cpu: "0.1"
volumeMounts:
- mountPath: /redis-master-data
name: data
- mountPath: /redis-master
name: config
- name: sfagent-container
image: snappyflowml/sfagent:latest
imagePullPolicy: Always
command:
- /app/sfagent
- -enable-console-log
env:
- name: APP_NAME
value: <app_name>
- name: PROJECT_NAME
value: <project_name>
volumeMounts:
- name: configmap-sfkubeagent
mountPath: /opt/sfagent/config.yaml
subPath: config.yaml
volumes:
- name: data
emptyDir: {}
- name: config
configMap:
name: redis-config-map
items:
- key: redis-config
path: redis.conf
- name: configmap-sfkubeagent
configMap:
name: redis-config-map
items:
- key: config.yaml
path: config.yaml

Viewing data and dashboards

  • Data generated by plugin can be viewed in browse data page inside the respective application under plugin=redisdb  and  documentType=serverDetails
  • Dashboard for this data can be instantiated by Importing dashboard template RedisDB to the application dashboard