Charts: [jenkins] is there a way to persist jenkins data without a PVC?

Created on 29 Aug 2017  Â·  7Comments  Â·  Source: helm/charts

Is this a request for help?:

is there a way to configure the jenkins chart to store data in a host volume rather than a persistent volume claim? We use openstack w/o persistent vol claim support.

Version of Helm and Kubernetes:

1.5.6k8s, 2.5.0helm

Which chart:

jenkins

lifecyclrotten

Most helpful comment

Hi @pswenson,

You need to create a PersistentVolume with hostPath and storageClassName separately and let the Jenkins chart create the PVC for you. Hope the example below helps you out.

Create a PersistentVolume with a storageClassName and hostPath before deploying the Jenkins chart

kind: PersistentVolume
apiVersion: v1
metadata:
  name: jenkins-pv
spec:
  storageClassName: jenkins-pv
  capacity:
    storage: 8Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  hostPath:
    path: "/mnt/k8s_volume/jenkins_home"

Deploy the Jenkins chart with these overrides

Persistence:
  Enabled: true
  # Use the same storage class defined in the PersistentVolume 
  StorageClass: jenkins-pv
  Size: 8Gi

All 7 comments

Hi @pswenson,

You need to create a PersistentVolume with hostPath and storageClassName separately and let the Jenkins chart create the PVC for you. Hope the example below helps you out.

Create a PersistentVolume with a storageClassName and hostPath before deploying the Jenkins chart

kind: PersistentVolume
apiVersion: v1
metadata:
  name: jenkins-pv
spec:
  storageClassName: jenkins-pv
  capacity:
    storage: 8Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  hostPath:
    path: "/mnt/k8s_volume/jenkins_home"

Deploy the Jenkins chart with these overrides

Persistence:
  Enabled: true
  # Use the same storage class defined in the PersistentVolume 
  StorageClass: jenkins-pv
  Size: 8Gi

Thanks. I tried deploying this:

kind: PersistentVolume
apiVersion: v1
metadata:
  name: jenkins-pv
spec:
  selector:
      jenkins: master
  storageClassName: jenkins-pv
  capacity:
    storage: 90Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  hostPath:
    path: "/data/jenkins"

but get this error:

kubectl create -f ./jenkins-pv.yaml
error: error validating "./jenkins-pv.yaml": error validating data: [found invalid field selector for v1.PersistentVolumeSpec, found invalid field storageClassName for v1.PersistentVolumeSpec]; if you choose to ignore these errors, turn validation off with --validate=false

I'm reading up on persistent volumes and storage class names but most doc assumes AWS or GCE.

I just removed the storageClassName and selector like

kind: PersistentVolume
apiVersion: v1
metadata:
  name: jenkins-pv
spec:
#  selector:
#      jenkins: master
#  storageClassName: jenkins-pv
  capacity:
    storage: 90Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  hostPath:
    path: "/data/jenkins"

the PV was created... now seeing if I can actually get it to work with the chart...

No dice.... I think this is the problem (from k8s doc): HostPath (single node testing only – local storage is not supported in any way and WILL NOT WORK in a multi-node cluster)

see https://kubernetes.io/docs/concepts/storage/persistent-volumes/#types-of-persistent-volumes

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or @fejta.
/lifecycle stale

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
/remove-lifecycle stale

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Was this page helpful?
0 / 5 - 0 ratings