Jenkins-Kubernetes Plugin Workspace Issue

8/7/2018

An environment is configured that uses kubernetes pods to instantiate master node and slaves nodes. Everyting works fine except that the workspace is not available on jenkins UI when the slave is taken down by the kubernetes (slave offline). I have tried several solutions (using an NFS) .... but it doesn't work ... Jenkins don't want to display the workspace (even if the workspace is at the right NFS location, and on the master). Any pointers on the same is really appreciated.

-- user10167541
jenkins
kubernetes
workspace

1 Answer

8/8/2018

Jenkins' kubernetes plugin adds and removes slaves on demand, but as far as core Jenkins is concerned, they're permanent slaves which have their own workspaces. Jenkins doesn't know that their workspaces are on NFS, only that the slave is gone and the workspace is inaccessible. That's one of the limitations of ephemeral slaves.

If you want to persist something from the workspace in this environment, the best way would be to create a build artifact so that Jenkins archives it.

You could also avoid using the kubernetes plugin, and spin up several persistent slaves in Kubernetes which are seldom torn down, or give them persistent agent ID's.

-- Marcin Romaszewicz
Source: StackOverflow