Commands and arguments

As most applications run as containers when deployed in a K8s cluster, one can define custom commands and arguments to run the container.

In this sense, a parallel can be drawn to configuring a container in docker:

In DockerIn K8s configWhat it does
CMDargsCommand that will be executed when the container starts or alternatively arguments for the ENTRYPOINT of the container
ENTRYPOINTcommandSpecifies the command to run when the container starts (completely replacing Dockerfile ENTRYPOINT).

For example

apiVersion: v1
kind: Pod
metadata:
  name: nginx-pod
  labels:
    app: nginx 
spec:
  containers:
    - name: nginx-container
      image: nginx
      command:
        - sleep # Override default ENTRYPOINT
      args:
        - "5" # Pass 5 as the arg for sleep