2

I created a pod which serve redis database and i want to leave it running when complete. Containers are meant to run to completion. Do i need to create and infinity loop which never ends ?

apiVersion: v1
kind: Pod
metadata:
  name: redis
spec:
  containers:
  - name: redis
    image: lfccncf/redis:latest
    command: [ "/bin/bash", "-c", "--" ]
    args: [ "while true; do sleep 30; done;" ]
Arghya Sadhu
  • 41,002
  • 9
  • 78
  • 107
O.Man
  • 585
  • 2
  • 9
  • 20

2 Answers2

2

If the container has a process which keeps running then you don't need to use infinite loop. In this case the container will run the redis process.The dockerfile will have the RUN command to execute the process.

Also I suggest you use a standard redis image or a helm chart to deploy redis.

Here is guide on running PHP guestbook app with redis

Arghya Sadhu
  • 41,002
  • 9
  • 78
  • 107
1

it is no need

command: [ "/bin/bash", "-c", "--" ]
args: [ "while true; do sleep 30; done;" ]enter code here

delete it

Miffa Young
  • 107
  • 4