I tried to create the POD using command
kubectl run --generator=run-pod/v1 mypod--image=myimage:1 -it bash
and after successful pod creation it prompts for bash command in side container.
Is there anyway to achieve above command using YML file? I tried below YML but it does not go to bash directly after successful creation of POD. I had to manually write command kubectl exec -it POD_NAME bash
. But want to avoid using exec command to bash my container. I want my YML to take me to my container after creation of POD. is there anyway to achieve this?
apiVersion: v1
kind: Pod
metadata:
name: mypod
namespace: mynamespcae
labels:
app: mypod
spec:
containers:
- args:
- bash
name: mypod
image: myimage:1
stdin: true
stdinOnce: true
tty: true
question from:
https://stackoverflow.com/questions/65601006/kubernetes-bash-to-pod-after-creation 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…