Issue
apiVersion: v1
kind: Pod
spec:
serviceAccountName: <service account name in kubernetes>
containers:
- name: spark-submit
image: <image arn>
command:
- cat
tty: true
- name: kube-tools
image: <image arn>
command:
- cat
tty: true
this is the part of yaml configuration of kubernetes agent in Jenkinsfile, what does the - cat tty: true means? i suppose tty: true means activating the terminal.
Solution
Please note that these are two different settings.
With tty: true
you enable a TTY which is required for execution of a shell.
The second is cat
as argument for the container command
. It means that the cat
executable is run without further arguments.
If you run cat
on a terminal yourself in this , you will notice that it does nothing, but blocks and waits for input. The reason is that the cat
command ("concatenate" in short) reads input from a file or stdin and prints it. If there is nothing, it just waits. (See the manpage here as well: https://man7.org/linux/man-pages/man1/cat.1.html )
That is often the sole idea: Start a container or Pod and keep it running. It will be terminated by other means.
You can think of it like sleep (infinity)
.
Answered By - Thomas
Answer Checked By - Marilyn (JavaFixing Volunteer)