Kubernetes CMD的常见写法

command: ['/bin/sh']

command:  ["rm", "-fr", "/var/lib/dbs/lost+found"]

command:
- 'sh'
- '-c'
- 'pwd'

command: ["sh", "-c", "pwd; sleep 2; pwd;"]

command: ["sh"]
args: ["-c","pwd; sleep 2; pwd;"]

如果脚本很长,又想写进 yaml文件

command: ['sh']
        args:
        - "-c"
        - |
          set -ex
          if [ "$a" -eq "$b" ];then
            touch /tmp/test
          else
            echo "not eq"
          fi
Send a Message