Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
751 views
in Technique[技术] by (71.8m points)

kubernetes - kubectl YAML config file equivalent of "kubectl run ... -i --tty ..."

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...