jglick so the general issue is the combination of 1 docker workflow script starting multiple docker containers; and those containers expecting to share a volume between them (so they can share the same workflow state).
In kubernetes you can do that by using a persistent (distributed) shared disk and then running each docker container as a separate Pod and mounting this shared disk image; the only downside is thats kinda complex to do in Kubernetes and its highly cloud specific (whether using GKE's shared volumes or Gluster / Ceph et al) and I'm sure there could be all kinds of icky concurrency/distributed issues with disks not quite syncing correctly or out of order things happening etc. Since the workflow is parallel, any container could be reading/writing in any order etc.
Another approach you can do is run 1 Pod which runs a separate local docker daemon and then run all the docker containers inside that single pod in a separate docker daemon. (So its Docker in Docker - or DIND); the main issue there is that it feels a bit like a hack and none of the kubernetes tooling can see these child docker images; so none of the tools for watching logs or doing 'docker exec' or even the docker CLI would work easily.
So the other approach in kubernetes is if you put all the containers you're going to need together in a single pod; all those docker containers get put on the same host and can share local regular disk volumes with each other trivially. So turning a Jenkins Docker Workflow script into a Pod (so 1 container to run the workflow and another container for each docker.image() statement) would mean the entire workflow would run completely on a single host; could use shared disk easily (which also gets persisted if the pod dies and gets restarted elsewhere) and would mean all the kubernetes tooling would be able to look inside the workflow directly into any container; so you could watch/grep the logs of any of the containers; run bash inside the containers and see what they're up to etc.
This last approach feels like the ideal way of combining Jenkins Docker Workflow with Kubernetes; it provides a simple way to do slaves (just run a k8s pod) and provides great tooling for developers to look inside builds that are not behaving as you expect etc - (just use kubernetes directly!).
The only downside is we'd need a way for the master, when its about to start a Jenkins Workflow instance - to analyse the jenkins workflow DSL to figure out all the docker images that are going to be required; then a Pod can be built (which is basically a list of containers, their images, any CLI / env vars etc) - then the workflow could run as before. So a little bit of ninja Jenkins Workflow DSL stuff would be required to figure out the docker images that would be required before really running the workflow - but if we could do that then we'd have an amazing way to combine Jenkins Docker Workflows with Kubernetes Pods.
One day - could be years off mind - there might be a way of dynamically adding Containers to a running Pod instance in kubernetes; which would make this really trivial to do in Jenkins Docker Workflow. We'd just start a Jenkins Workflow instance off in a Pod and add new containers as required to the Pod - but that doesn't look like happening any time soon; so we need to add all the containers into the pod up front right now.
Until then, the "Docker in docker" hack seems the tactical solution though. I'm wondering how hard it'd be to hack up something to know, without invoking any of the steps in the DSL other than docker.image() - what all the docker images are in a Jenkins workflow DSL? (I should know more than I do about it - I created Groovy over a decade ago now and my Groovy DSL ninja stuff isn't what it used to be I'm afraid
.
Do not fully follow what you are requesting, but it sounds like something that would require a new DSL feature, if not a new plugin; ndeloof had a withKubernetes step somewhere, but I do not know where.