jenkins.io icon indicating copy to clipboard operation
jenkins.io copied to clipboard

[Documentation] Volume is not persistent when using YAML files

Open tadrian88 opened this issue 3 years ago • 5 comments

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

tadrian88 avatar Feb 17 '22 11:02 tadrian88

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.

tanujdevops avatar Oct 03 '22 09:10 tanujdevops

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.

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 avatar Oct 04 '22 14:10 dduportal

@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?

zbynek avatar Oct 04 '22 17:10 zbynek

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.

MarkEWaite avatar Oct 04 '22 17:10 MarkEWaite

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.

tanujdevops avatar Oct 04 '22 21:10 tanujdevops

This issue can be closed. As this is addressed in https://github.com/jenkins-infra/jenkins.io/pull/5548

Vandit1604 avatar Jan 19 '23 19:01 Vandit1604

Thanks @Vandit1604 and @tanujdevops

MarkEWaite avatar Jan 19 '23 23:01 MarkEWaite