kubectl YAML config file equivalent of “kubectl run … -i --tty …”

你。 提交于 2019-11-27 23:28:28

问题


I've been using "kubectl run" with assorted flags to run Jobs interactively, but have recently outgrown what I can do with those flags, and have graduated to using YAML config files to describe my jobs.

However, I can't find an equivalent to the "-i" and "--tty" flags, to attach to the Job I'm creating.

Is there an equivalent YAML spec for:

kubectl run myjob \
            -i \
            --tty \
            --image=grc.io/myproj/myimg:mytag \
            --restart=Never \
            --rm \
            -- \
            my_command

Or is this maybe not the right approach?


回答1:


I think you are mentioning these fields. https://github.com/kubernetes/kubernetes/blob/master/pkg/api/types.go#L1004-L1006

You can define stdin and tty in yaml file.

apiVersion: v1 
kind: Pod 
metadata: 
  name: test 
spec: 
  containers: 
    - name: test 
      image: test 
      stdin: true 
      tty: true 


来源:https://stackoverflow.com/questions/37559704/kubectl-yaml-config-file-equivalent-of-kubectl-run-i-tty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!