Kubernetes
In your watchlog-node-agent.yaml, locate the Redis env vars:
- name: MONITOR_REDIS
value: "false"
- name: REDIS_HOST
value: "127.0.0.1"
- name: REDIS_PORT
value: "6379"
- name: REDIS_PASSWORD
value: ""
Change to:
- value: "false"
+ value: "true"
Update host/port/password as needed, then apply:
kubectl apply -f watchlog-node-agent.yaml
Keep the password in a Secret
apiVersion: v1
kind: Secret
metadata:
name: watchlog-redis
namespace: watchlog
type: Opaque
stringData:
password: "your_password"
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: watchlog-redis
key: password
For a Helm-deployed Redis the password is usually already in a generated Secret — reference that one instead of creating a second:
kubectl get secret redis -n database -o go-template='{{.data "redis-password" | base64decode}}'
Pointing at a Redis Service
The node agent runs as a DaemonSet, so 127.0.0.1 only reaches a Redis on that same node. For a cluster-hosted Redis, use the Service DNS name:
- name: REDIS_HOST
value: "redis-master.database.svc.cluster.local"
- name: REDIS_PORT
value: "6379"
protected-mode
Redis refuses connections from outside localhost when protected-mode is on and no password is set. From Redis's perspective the agent connects from a pod IP, so a password-less Redis rejects it. Set a password rather than disabling protected mode.
Which agent should monitor it?
A DaemonSet means every node's agent polls Redis — N agents collecting the same data. Watchlog identifies an instance by host:port, so they all write to the same integration and the data stays correct, but the polling is wasted.
- Preferred: run a single-replica Deployment of the agent dedicated to integrations, and keep the DaemonSet for host and container metrics only.
- Or use a node selector so only one node's agent carries the Redis env vars.
Replicas and Sentinel
Point the agent at the master Service for the authoritative view. Adding each replica Service as a separate entry is worth doing: a replica reports its own master link status and offset lag, which the primary cannot tell you.
For Sentinel-managed deployments, point at the current master's Service. Watchlog identifies an instance by host:port, so a failover that moves the master behind the same Service name keeps one continuous integration.
Redis Cluster
Point the agent at any node. CLUSTER INFO and CLUSTER NODES describe the whole cluster, so one entry covers cluster state, slot coverage, and every node's role and link state.
Watchlog flags incomplete slot coverage specifically — slots that are unassigned make part of the keyspace unreachable, which is different from a node merely being down.
Advanced options in Kubernetes
The env vars cover the connection. For the ACL username, collection caps, or slowlog tuning, mount an integration.json through a ConfigMap:
apiVersion: v1
kind: ConfigMap
metadata:
name: watchlog-integrations
namespace: watchlog
data:
integration.json: |
[
{
"service": "redis",
"monitor": true,
"host": "redis-master.database.svc.cluster.local",
"port": "6379",
"username": "watchlog_monitor",
"advanced": {
"commands": true,
"keyspace": true,
"replication": true,
"cluster": true,
"maxCommands": 200,
"commandsIntervalSeconds": 60
},
"slowlog": {
"enabled": true,
"limit": 128,
"maxPerScrape": 100
}
}
]
volumeMounts:
- name: integrations
mountPath: /app/app/config/integration.json
subPath: integration.json
readOnly: true
volumes:
- name: integrations
configMap:
name: watchlog-integrations
Warning
Do not put the password in the ConfigMap — a ConfigMap is readable by anything with get on the namespace. Keep it in the REDIS_PASSWORD Secret env var.
Memory limit
A containerised Redis with no maxmemory grows until the pod's memory limit kills it. Watchlog cannot warn about a limit that does not exist — it reports usage without a percentage rather than inventing one.
kubectl exec -n database statefulset/redis-master -- redis-cli CONFIG GET maxmemory
Setting maxmemory somewhat below the pod's memory limit, with a maxmemory-policy, is what makes the memory-pressure part of the health score meaningful — and is what prevents an OOMKill.
