GoogleCloudPlatform/continuous-deployment-on-kubernetes

switching from Deployment to StatefulSet due to persistent volumes

triesz opened this issue · 2 comments

I have deployed jenkins based on this on a vanilla k8s on bare metal, using storageos.
Unfortunately I hit filesystem issues multiple times, then I learned that
kind: Deployment
is probably not the best when using persistent volumes.

should jenkins not be deployed as StatefulSet instead?

(I am currently trying to switch to StatefulSet, btw, jenkins UI comes up OK but the launched slave pods started to have DNS issues somehow...)

Jenkins doesn't scale out so in this case Deployment or StatefulSet of size 1 will have the same behavior since Jenkins doesn't require a static hostname.

huu I am super k8s-newbie to asses this myself, however, I was told that in case of Deployment kubernetes does not guarantee that only 1 pod is running. Did I understand this right?
(And in fact I did manage to somehow corrupt my persistent jenkins home fs somehow, as I was tuning memory settings and kept applying modified yamls over and over again...)

Anyhow, in case someone bumps into this I have just found a statefulset example here:
https://github.com/jenkinsci/kubernetes-plugin/tree/master/src/main/kubernetes

referenced from the kubernetes plugin doc:
https://github.com/jenkinsci/kubernetes-plugin/blob/master/README.md