Kubectl Logs Command Terminated Automatically During Exection of Pipeline

Hi Folks,

We are using Jenkins version [2.375.2] and running a pipeline which performs multiple integration test, during the execution, we collect multiple pod’s log using the following command :

$ kubectl logs -f -n default --kubeconfig /root/volumes/workspace/workspace/integration-test-dev-xxxx/secrets/dev_kube.config --context xxxx-cluster-dev-xxxx <pod-name>-prov-568bdc9cf-m52dz

We also collect the PIDs of such above commmands. Once the test cases are completed then these commands are deleted using kill command.

Here issue is that some of these kubectl logs command are terminated automatically before we run kill command, you can also verify with output. We need some suggestions and hinters to address and fix this Issue.

Do we have a default timeout for shell commands. If the kubectl logs command takes longer than this timeout, Jenkins will terminate it.

Here workspace is a POD from Kubernetes Cluster.

LOG_PIDS=' 794 795 796 797 798 799 803 813 814 819 823 824 828 835 836 837 839 842 843 844 848 853'

02:18:41.018 + for pid in $LOG_PIDS
02:18:41.018 + kill 794
02:18:41.018 + for pid in $LOG_PIDS
02:18:41.018 + kill 795
02:18:41.018 /tmp/jenkins6201083829752684843.sh: line 631: kill: (795) - No such process
02:18:41.018 + true
02:18:41.018 + for pid in $LOG_PIDS
02:18:41.018 + kill 796
02:18:41.018 + for pid in $LOG_PIDS
02:18:41.018 + kill 797
02:18:41.018 + for pid in $LOG_PIDS
02:18:41.018 + kill 798
02:18:41.018 + for pid in $LOG_PIDS
02:18:41.018 + kill 799
02:18:41.019 /tmp/jenkins6201083829752684843.sh: line 631: kill: (799) - No such process
02:18:41.019 + true
02:18:41.019 + for pid in $LOG_PIDS
02:18:41.019 + kill 803
02:18:41.019 /tmp/jenkins6201083829752684843.sh: line 631: kill: (803) - No such process
02:18:41.019 + true
02:18:41.019 + for pid in $LOG_PIDS
02:18:41.019 + kill 813
02:18:41.019 /tmp/jenkins6201083829752684843.sh: line 631: kill: (813) - No such process
02:18:41.019 + true
02:18:41.019 + for pid in $LOG_PIDS
02:18:41.019 + kill 814
02:18:41.019 /tmp/jenkins6201083829752684843.sh: line 631: kill: (814) - No such process
02:18:41.019 + true
02:18:41.019 + for pid in $LOG_PIDS
02:18:41.019 + kill 819
02:18:41.019 /tmp/jenkins6201083829752684843.sh: line 631: kill: (819) - No such process
02:18:41.019 + true
02:18:41.019 + for pid in $LOG_PIDS
02:18:41.019 + kill 823
02:18:41.019 /tmp/jenkins6201083829752684843.sh: line 631: kill: (823) - No such process
02:18:41.019 + true
02:18:41.019 + for pid in $LOG_PIDS
02:18:41.019 + kill 824
02:18:41.019 /tmp/jenkins6201083829752684843.sh: line 631: kill: (824) - No such process
02:18:41.019 + true
02:18:41.019 + for pid in $LOG_PIDS
02:18:41.019 + kill 837
02:18:41.019 + for pid in $LOG_PIDS
02:18:41.019 + kill 839
02:18:41.019 + for pid in $LOG_PIDS
02:18:41.019 + kill 842
02:18:41.019 + for pid in $LOG_PIDS
02:18:41.019 + kill 843
02:18:41.019 /tmp/jenkins6201083829752684843.sh: line 631: kill: (843) - No such process
02:18:41.019 + true
02:18:41.019 + for pid in $LOG_PIDS
02:18:41.019 + kill 844
02:18:41.019 /tmp/jenkins6201083829752684843.sh: line 631: kill: (844) - No such process
02:18:41.019 + true
02:18:41.019 + for pid in $LOG_PIDS
02:18:41.019 + kill 848
02:18:41.019 /tmp/jenkins6201083829752684843.sh: line 631: kill: (848) - No such process
02:18:41.019 + true
02:18:41.019 + for pid in $LOG_PIDS
02:18:41.019 + kill 853
02:18:41.019 /tmp/jenkins6201083829752684843.sh: line 631: kill: (853) - No such process
02:18:41.019 + true
02:18:41.019 + for pid in $LOG_PIDS
02:18:41.019 + kill 1459