persistentvolumeclaim "jenkins-volume-claim" not found

11/10/2018

In my minikube I'm getting an error persistentvolumeclaim "jenkins-volume-claim" not found

I'm installing jenkins using helm with the command below:

helm install --name jenkins -f kubernetes/jenkins-values.yaml stable/jenkins --namespace jenkins-system

the snippet about Persistence in jenkins-values.yaml is below:

Persistence:
  Enabled: true
  ## A manually managed Persistent Volume and Claim
  ## Requires Persistence.Enabled: true
  ## If defined, PVC must be created manually before volume will be bound
  ExistingClaim: jenkins-volume-claim

I've created a persistence volume using the command below:

kubectl create -f persistence.yaml

persistence.yaml looks like this:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: jenkins-volume
spec:
  accessModes:
    - ReadWriteOnce
  capacity:
    storage: 5Gi
  hostPath:
    path: /data/jenkins-volume/

Question

I have persistence volume jenkins-volume created but am still getting error persistentvolumeclaim "jenkins-volume-claim" not found. How can I resolve this?

-- Anthony
jenkins
kubernetes
kubernetes-helm

2 Answers

11/10/2018

Look at this line,

## If defined, PVC must be created manually before volume will be bound
ExistingClaim: jenkins-volume-claim

So, you have to PersistentVolumeClaim not PersistentVolume with name jenkins-volume-claim.

See what is PersistentVolumeClaim from here: PersistentVolumeClaims

-- Emruz Hossain
Source: StackOverflow

11/11/2018

The error message points to missing PersistentVolumeClaim named jenkins-volume-claim. To create one, execute:

kubectl -n <namespace> create -f - <<EOF
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: jenkins-volume-claim
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 5Gi
EOF

Executing after that kubectl get pv should show the jenkins-volume PV in Bound status (assuming the PV has been created already with capacity of at least 5Gi).

Use selector(s) as described here to make sure the claim will bind to the desired pre-created PV (persistent volume) in case there are more than one PV available with proper capacity.

-- apisim
Source: StackOverflow