I want to start a container and directly run redis-cli
interactively inside. For some reason, in my attempts, the input is always ignored.
Launching an interactive shell and then launching the program manually works:
# in my local shell:
$ kubectl run redis-cli --image redis:latest --attach --leave-stdin-open --rm -it --command -- bash
# then in container shell:
root@redis-cli:/data# redis-cli -h redis.example.com
# now the redis-cli shell is open:
redis.example.com:6379>
How do I combine this into one command that brings me directly into the redis-cli
shell? I've tried the following, but I see no prompt and all my input is ignored. I can't even ctrl-C or ctrl-D out of it.
kubectl run redis-cli2 --image redis:latest --attach --leave-stdin-open --rm -it --command -- redis-cli -h redis.example.com --stat
# or
kubectl run redis-cli2 --image redis:latest --attach --leave-stdin-open --rm -it --command -- bash -ic -- "redis-cli -h redis.example.com --stat"
If I do a --stat
, I see command output. If I do a ping
, I see the ping arrive at the Redis server (using monitor
from another container) but I never see any output and the pod goes into CrashLoopBackOff
before terminating.
At this point, I'm not sure if this behavior is specific to redis-cli
or the redis
image or if this behavior is the same for other interactive programs (well, at least bash
seems to work as expected).