Redis via Client Service Using a Temporary Pod
Namespace: project-redis-dev
Redis Pods: redis-0, redis-1, redis-2
Client Service: redis-client-service
Password: mypassword
Step 1: Launch Temporary Client Pod
kubectl run redis-client-test --rm -it --image=redis:7-alpine --restart=Never --namespace default -- sh
--rmdeletes pod on exit-itinteractive shell-- shshell in Alpine image
Step 2: Connect via Client Service
Inside pod shell:
redis-cli -h redis-client-service -p 6379 -a mypassword
- Connects through ClusterIP service (load-balanced across pods)
Step 3: Test Redis Commands
PING SET testkey "Hello via client service" GET testkey
Expected Output:
PONG
OK
"Hello via client service"
PINGconnectivity checkSETwrite dataGETread data
testkeyis just a sample key; replace as needed.
Step 4: Exit
QUIT
Then exit pod shell (Ctrl+D). Pod auto-deletes.
Result:
- Redis is reachable via client service
- Read/write operations verified
- No local Redis installation needed
