等同于"kubectl run ... -i --tty ..."的kubectl YAML配置文件 [英] kubectl YAML config file equivalent of "kubectl run ... -i --tty ..."
问题描述
我一直在使用带有各种标志的"kubectl run"来交互式地运行Jobs,但是最近我已经无法使用这些标志了,并且已经毕业于使用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"标志等效的东西来附加到我正在创建的Job上.
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/api/types.go#L1004-L1006
I think you are mentioning these fields. https://github.com/kubernetes/kubernetes/blob/master/pkg/api/types.go#L1004-L1006
您可以在yaml文件中定义stdin
和tty
.
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 run ... -i --tty ..."的kubectl YAML配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!