I'm trying to add preexisting volume to one of my deployment to use persistent data to jenkins. I'm using hetzner cloud as cloud provider and also using sci drivers to point the preexisting volume. But I'm getting below error,
this is my volume.yml file
apiVersion: v1
kind: PersistentVolume
metadata:
name: jenkins-pv
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 10Gi
claimRef:
apiVersion: v1
kind: PersistentVolumeClaim
name: jenkins-pvc
namespace: development
csi:
driver: csi.hetzner.cloud
fsType: ext4
volumeHandle: "111111"
readOnly: false
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: csi.hetzner.cloud/location
operator: In
values:
- hel1
persistentVolumeReclaimPolicy: Retain
storageClassName: hcloud-volumes
volumeMode: Filesystem
this is my deployment file
apiVersion: apps/v1
kind: Deployment
metadata:
name: jenkins
namespace: development
spec:
replicas: 1
selector:
matchLabels:
app: jenkins-server
template:
metadata:
labels:
app: jenkins-server
spec:
imagePullSecrets:
- name: regcred
securityContext:
allowPrivilegeEscalation: true
privileged: true
readOnlyRootFilesystem: false
runAsUser: 0
serviceAccountName: jenkins
containers:
- name: jenkins
image: jenkins/jenkins:lts-jdk11
resources:
limits:
memory: "2Gi"
cpu: "1000m"
requests:
memory: "500Mi"
cpu: "500m"
ports:
- name: httpport
containerPort: 8080
- name: jnlpport
containerPort: 50000
livenessProbe:
httpGet:
path: "/login"
port: 8080
initialDelaySeconds: 90
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 5
readinessProbe:
httpGet:
path: "/login"
port: 8080
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
volumeMounts:
- name: jenkins-pv
mountPath: /var/jenkins_home
volumes:
- name: jenkins-pv
persistentVolumeClaim:
claimName: jenkins-pv
is there any way to fix this?