Introduction
This guide explains how to use Redis within a Kubernetes environment, including installation, configuration, and basic Redis commands.
Installation
Install Redis Tools
# Install Redis CLI tools
sudo apt install redis-tools
Configuration
Kubernetes Resources
ConfigMap
# Get Redis ConfigMap
kubectl get configmap -n resilience-api redis -o yaml
# Output:
apiVersion: v1
data:
address: 10.59.242.156:6379
kind: ConfigMap
Secret
# Get Redis authentication secret
kubectl get secrets -n resilience-api redis-auth -o yaml
# Output:
apiVersion: v1
data:
auth_string: MzRkZDlmYTItZjYxYS00ZTA2LTgzMmUtNTFiZDkwZWY4NDEy
kind: Secret
Connecting to Redis
# Connect to Redis using host and authentication
redis-cli -h 10.0.0.156
auth_string: MzRkZDlmYTItZjYxYS00ZTA2LTgzMmUtNTFiZDkwZWY4NDEy
Basic Redis Commands
# Check Redis server information
info
# Test connection
ping
# List all keys
keys *