kubectl YAML 配置文件相当于“kubectl run ... -i --tty ..." [英] kubectl YAML config file equivalent of "kubectl run ... -i --tty ..."

查看:40
本文介绍了kubectl YAML 配置文件相当于“kubectl run ... -i --tty ..."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用带有各种标志的kubectl run"以交互方式运行作业,但最近我已经超出了我可以用这些标志做的事情,并且已经毕业使用 YAML 配置文件来描述我的作业.

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.

但是,我找不到与-i"和--tty"标志等效的标志来附加到我正在创建的作业.

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

是否有等效的 YAML 规范:

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?

推荐答案

我想你提到了这些领域.https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/core/types.go#L2081-L2088

I think you are mentioning these fields. https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/core/types.go#L2081-L2088

您可以在yaml文件中定义stdintty.

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 

这篇关于kubectl YAML 配置文件相当于“kubectl run ... -i --tty ..."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆