Copying file from host laptop(mac) to dynamically created kubernetes pod via Jenkins pipeline

11/28/2018

I installed minikube and started Jenkins inside a pod. I am able to create a new job and execute it inside a dynamically created maven container. However. I have a folder in my host machine which is a Mac based and I need that folder inside this dynamically created pod when the job is started. How can I achieve that?

-- Damien-Amen
jenkins
kubernetes
minikube

2 Answers

11/29/2018

Option 1.

https://kubernetes.io/docs/setup/minikube/#interacting-with-your-cluster

configure kubectl on your MAC, then use kubectl cp <hostdir> <podname>:<dir>

Option 2.

use the Host path option for POD, like this post

Mount local directory into pod in minikube

-- sfgroups
Source: StackOverflow

11/28/2018

Maybe the easiest solution is to push that folder as git repo ( if it is not large ) to either github or your private git server , and then clone it as a first step in your jenkins job.

-- Ijaz Ahmad Khan
Source: StackOverflow