-1

I know that it is possible to execute multiple commands simultaneously in Kubernetes. I've seen Multiple commands in kubernetes. But what I wanted to know is to execute multiple commands simultaneously.

command: ["/bin/sh","-c"]
args: ["command one; command two"]

Here both command one and command two execute parallel.

As command one starts a server instance and similarly command two start another server.

In my docker environment I have specified one command and then I exec int docker and start another command. But in k8s deployment it won't be possible. What should I do in this situation?

I will be using helm chart, so if there is any trick related to helm charts. I can use that as well.

Pranjal Doshi
  • 862
  • 11
  • 29
  • 1
    No, that won't work. Can do 2 different deployments, 1 service each or build your image with i.e. [`supervisord` that runs the 2 services](https://docs.docker.com/config/containers/multi-service_container/). – masseyb Dec 04 '20 at 10:18
  • 1
    You should run two separate Deployments (just like, in plain Docker, you should run two separate containers). They can have the same `image:` but different `command:`, `containerPorts:`, _etc._ – David Maze Dec 04 '20 at 10:48
  • I believe you can also have two or more containers in one Pod (or Deployment/StatefulSet ). They will share network layer and can also share ephemeral storage for cooperation. And you can configure separate liveness and readiness probes for each container in the Pod. – VAS Dec 24 '20 at 10:21

1 Answers1

0

Fully agree with @David Maze and @masseyb. Writing answer as community wiki just to index this answer for future researches. You are not able to execute simultaneously multiple commands. You should create few similar but separate deployments and use there different commands.

Vit
  • 7,740
  • 15
  • 40