jenkins.io
jenkins.io copied to clipboard
[Documentation] Volume is not persistent when using YAML files
Problem with the Kubernetes page, source file
TODO: Describe the expected and actual behavior here
The documentation for "Install Jenkins with YAML files" states that if you use the deployment found here you will end up with a volume that is persistent.
However, since the volume type if emptyDir, when you delete the pod, the information written to the mountPath will get lost.
Possible Solution
For testing purposes and local development, hostPath volume type should be used instead
A hostPath volume mounts a file or directory from the host node's file system into your pod.
So should I just replace emptyDir: { } with hostPath: {}?
Also, a hostPath Persistent Volume must be used only in a single-node cluster. Kubernetes does not support hostPath on a multi-node cluster currently.
A
hostPathvolume mounts a file or directory from the host node's file system into your pod. So should I just replaceemptyDir: { }withhostPath: {}? Also, ahostPathPersistent Volume must be used only in a single-node cluster. Kubernetes does not supporthostPathon a multi-node cluster currently.
It is true that changing from emptyDir to hostPath would ensure that data persists a jenkins pod deletion as per https://kubernetes.io/docs/concepts/storage/volumes/#emptydir.
But hostPath is not a solution either: as per https://kubernetes.io/docs/concepts/storage/volumes/#hostpath, it implies security concerns (permissions mainly) and does not guarantuee persistence when Jenkins pod is rescheduled to another working node.
WDYT about mentioning the "non persistence" and pointing to both:
- The official Jenkins Helm Chart (which should be preferred to generate the YAML file at least) at
- The official https://kubernetes.io/docs/concepts/storage/persistent-volumes/ doc
@dduportal the part of the tutorial focused on Helm installation is suggests creating a persistent volume using hostPath and links to the official documentation page you mentioned https://www.jenkins.io/doc/book/installing/kubernetes/#create-a-persistent-volume as well as Jenkins official helm chart.
Maybe the YAML installation method should use the same storage type? Since this is not meant for production use and a clear disclaimer about hostPath limitations is provided, maybe that's OK?
Based on other comments from @dduportal, I'm more inclined to remove the YAML installation path and limit the documentation to helm charts with a link to the operator as an alternative. We've learned much more about managing a Jenkins installation in Kubernetes since this documentation was written in 2020. I think it may be time to remove the YAML description and focus on helm.
Comments and concerns from others are welcomed.
I have included the path to _kubernetes.adoc in the new PR #5548 where I have updated the document kubernetes.adoc.
The section Install Jenkins with YAML files is present in _kubernetes.adoc. So if we have to remove the YAML installation, we can remove it from here.
This issue can be closed. As this is addressed in https://github.com/jenkins-infra/jenkins.io/pull/5548
Thanks @Vandit1604 and @tanujdevops