Kubernetes - Passing multiple commands to the container

前端 未结 3 1703
北海茫月
北海茫月 2020-12-24 06:55

I want send multiple entrypoint commands to a Docker container in the command tag of kubernetes config file.

apiVersion: v1
kind: Pod
metadata:
         


        
3条回答
  •  醉话见心
    2020-12-24 07:08

    Jordan's answer is correct.

    But to improve readability I would prefer:

    apiVersion: v1
    kind: Pod
    metadata:
      name: hello-world
    spec:  # specification of the pod’s contents
      restartPolicy: Never
      containers:
      - name: hello
        image: "ubuntu:14.04"
        command: ["/bin/sh"]
        args:
          - -c
          - >-
              command1 arg1 arg2 &&
              command2 arg3 &&
              command3 arg4
    

    Read this to understand YAML block scalar (The above >- format).

提交回复
热议问题