How to use kubernetes pod file in my remote Jenkins job

1/24/2021

I have a jenkins server that has access to remote k8 cluster. I need to run a shell script as a part of jenkins job and pass it the file that is inside the remote kubernetes pod.

I don't want to copy the file from k8 pod to jenkins server as the file is huge ~25G.

I tried with creating a variable 'kubectl_variable' with value:

kubectl get -f pod:<path to file>
this gives error as:
error: the path "podname:/var/lib/datastorage/dump.txt" cannot be accessed: CreateFile podname:/var/lib/datastorage/dump.txt: The filename, directory name, or volume label syntax is incorrect.

I was thinking of passing this variable to the shell script as:

parse.sh ${kubectl_variable}

I am not sure if I can achieve this or not.

Will appreciate your help.

-- Manpreet Singh
jenkins
kubernetes
shell

0 Answers