Kubernetes: how do I specify command to run, for service to start

8/1/2019

I have a docker image that starts the service when I run

server start:8080

How can I specify this command to be run in Kubernetes Service? Is the only option to have it part Dockerfile ?

-- Sam
kubernetes

1 Answer

8/1/2019

I took "Kubernetes" and "specify command to run" from the title of your question and did an Internet search for "Kubernetes specify command to run" and the first result was this official Kubernetes doc. It says:

When you create a Pod, you can define a command and arguments for the containers that run in the Pod. To define a command, include the command field in the configuration file. To define arguments for the command, include the args field in the configuration file. The command and arguments that you define cannot be changed after the Pod is created.

The command and arguments that you define in the configuration file override the default command and arguments provided by the container image. If you define args, but do not define a command, the default command is used with your new arguments.

Note: The command field corresponds to entrypoint in some container runtimes....

-- Amit Kumar Gupta
Source: StackOverflow