Question

backup with pv and pvc

  • 21 December 2023
  • 5 comments
  • 192 views

Userlevel 1

when creating a backup with pv and pvc I get this error:

 cause:
cause:
fields:
- name: pvcName
value: example-pvc-2
- name: pvName
value: example-pv
- name: storageClassName
value: local-path-kasten
- name: namespace
value: default
file: kasten.io/k10/kio/exec/phases/phase/snapshot.go:243
function: kasten.io/k10/kio/exec/phases/phase.FetchSnapshotSession
linenumber: 243
message: Volume Snapshots are not supported for this storage provider.Try K10's
Generic Storage Backup
method(https://docs.kasten.io/latest/install/generic.html?#generic-storage-backup-and-restore)
or contact contact@kasten.io
file: kasten.io/k10/kio/exec/phases/backup/snapshot_data_phase.go:148
function: kasten.io/k10/kio/exec/phases/backup.(*SnapshotDataPhase).Run
linenumber: 148
message: Failed to fetch the snapshot session
message: Job failed to be executed
- cause:
cause:
fields:
- name: pvcName
value: example-pvc-2
- name: pvName
value: example-pv
- name: storageClassName
value: local-path-kasten
- name: namespace
value: default
file: kasten.io/k10/kio/exec/phases/phase/snapshot.go:243
function: kasten.io/k10/kio/exec/phases/phase.FetchSnapshotSession
linenumber: 243
message: Volume Snapshots are not supported for this storage provider.Try K10's
Generic Storage Backup
method(https://docs.kasten.io/latest/install/generic.html?#generic-storage-backup-and-restore)
or contact contact@kasten.io
file: kasten.io/k10/kio/exec/phases/backup/snapshot_data_phase.go:148
function: kasten.io/k10/kio/exec/phases/backup.(*SnapshotDataPhase).Run
linenumber: 148
message: Failed to fetch the snapshot session
message: Job failed to be executed
- cause:
cause:
fields:
- name: pvcName
value: example-pvc-2
- name: pvName
value: example-pv
- name: storageClassName
value: local-path-kasten
- name: namespace
value: default
file: kasten.io/k10/kio/exec/phases/phase/snapshot.go:243
function: kasten.io/k10/kio/exec/phases/phase.FetchSnapshotSession
linenumber: 243
message: Volume Snapshots are not supported for this storage provider.Try K10's
Generic Storage Backup
method(https://docs.kasten.io/latest/install/generic.html?#generic-storage-backup-and-restore)
or contact contact@kasten.io
file: kasten.io/k10/kio/exec/phases/backup/snapshot_data_phase.go:148
function: kasten.io/k10/kio/exec/phases/backup.(*SnapshotDataPhase).Run
linenumber: 148
message: Failed to fetch the snapshot session
message: Job failed to be executed

 /etc/configmaps$ curl https://docs.kasten.io/tools/k10_primer.sh | bash


Namespace option not provided, using default namespace
Checking for tools
--> Found kubectl
--> Found helm
--> Found jq
--> Found cat
--> Found base64
--> Found tr
Checking if the Kasten Helm repo is present
--> The Kasten Helm repo was found
Checking for required Helm version (>= v3.9.0)
--> No Tiller needed with Helm v3.13.1
K10Primer image
--> Using Image (gcr.io/kasten-images/k10tools:6.5.0) to run test
Checking access to the Kubernetes context kubernetes-admin@kubernetes
--> Able to access the default Kubernetes namespace
K10 Kanister tools image
--> Using Kanister tools image (gcr.io/kasten-images/k10tools:6.5.0) to run test

Running K10Primer Job in cluster with command
./k10tools primer
serviceaccount/k10-primer created
clusterrolebinding.rbac.authorization.k8s.io/k10-primer created
job.batch/k10primer created
Pod k10primer-dng8x is in Pending phase
Pod k10primer-dng8x is in Pending phase
Pod Ready!
================================================================
Kubernetes Version Check:
Valid kubernetes version (v1.27.3) - OK

RBAC Check:
Kubernetes RBAC is enabled - OK

Aggregated Layer Check:
The Kubernetes Aggregated Layer is enabled - OK

CSI Capabilities Check:
Using CSI GroupVersion snapshot.storage.k8s.io/v1 - OK

Validating Provisioners:
hostpath.csi.k8s.io:
Is a CSI Provisioner - OK
Storage Classes:
csi-hostpath-sc
Valid Storage Class - OK
Volume Snapshot Classes:
csi-hostpath-snapclass
Has k10.kasten.io/is-snapshot-class annotation set to true - OK
Has deletionPolicy 'Delete' - OK

kubernetes.io/no-provisioner:
Storage Classes:
default
Supported via K10 Generic Volume Backup. See https://docs.kasten.io/latest/install/generic.html.
local-path-kasten
Supported via K10 Generic Volume Backup. See https://docs.kasten.io/latest/install/generic.html.

Validate Generic Volume Snapshot:
Pod created successfully - OK
GVS Backup command executed successfully - OK
Pod deleted successfully - OK
================================================================
serviceaccount "k10-primer" deleted
clusterrolebinding.rbac.authorization.k8s.io "k10-primer" deleted
job.batch "k10primer" deleted

 

 

 


5 comments

Userlevel 7
Badge +22

I think the issue is that your csi  storageclass that supports snapshots is Storage Classes: csi-hostpath-sc but the workload that you are trying to snapshot is using “- name: storageClassName value: local-path-kasten”

If this is k3s then the local-path sc does not support snapshotting. So your application should be using the csi-hostpath-sc and then you should be able to snapshot without issues.

Userlevel 1

I think the issue is that your csi  storageclass that supports snapshots is Storage Classes: csi-hostpath-sc but the workload that you are trying to snapshot is using “- name: storageClassName value: local-path-kasten”

If this is k3s then the local-path sc does not support snapshotting. So your application should be using the csi-hostpath-sc and then you should be able to snapshot without issues.

 

when i use pod with volume class csi-hostpath-sc i get this error

- cause:
cause:
fields:
- name: pvcName
value: example-pvc-4
- name: pvName
value: example-pv-3
- name: storageClassName
value: csi-hostpath-sc
- name: namespace
value: it
file: kasten.io/k10/kio/exec/phases/phase/snapshot.go:243
function: kasten.io/k10/kio/exec/phases/phase.FetchSnapshotSession
linenumber: 243
message: Volume Snapshots are not supported for this storage provider.Try K10's
Generic Storage Backup
method(https://docs.kasten.io/latest/install/generic.html?#generic-storage-backup-and-restore)
or contact contact@kasten.io
file: kasten.io/k10/kio/exec/phases/backup/snapshot_data_phase.go:148
function: kasten.io/k10/kio/exec/phases/backup.(*SnapshotDataPhase).Run
linenumber: 148
message: Failed to fetch the snapshot session
message: Job failed to be executed
- cause:
cause:
fields:
- name: pvcName
value: example-pvc-4
- name: pvName
value: example-pv-3
- name: storageClassName
value: csi-hostpath-sc
- name: namespace
value: it
file: kasten.io/k10/kio/exec/phases/phase/snapshot.go:243
function: kasten.io/k10/kio/exec/phases/phase.FetchSnapshotSession
linenumber: 243
message: Volume Snapshots are not supported for this storage provider.Try K10's
Generic Storage Backup
method(https://docs.kasten.io/latest/install/generic.html?#generic-storage-backup-and-restore)
or contact contact@kasten.io
file: kasten.io/k10/kio/exec/phases/backup/snapshot_data_phase.go:148
function: kasten.io/k10/kio/exec/phases/backup.(*SnapshotDataPhase).Run
linenumber: 148
message: Failed to fetch the snapshot session
message: Job failed to be executed


 kubectl get storageclasses  csi-hostpath-sc -o json


{
"allowVolumeExpansion": true,
"apiVersion": "storage.k8s.io/v1",
"kind": "StorageClass",
"metadata": {
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"allowVolumeExpansion\":true,\"apiVersion\":\"storage.k8s.io/v1\",\"kind\":\"StorageClass\",\"metadata\":{\"annotations\":{},\"name\":\"csi-hostpath-sc\"},\"provisioner\":\"hostpath.csi.k8s.io\",\"reclaimPolicy\":\"Delete\",\"volumeBindingMode\":\"Immediate\"}\n",
"storageclass.kubernetes.io/is-default-class": "true"
},
"creationTimestamp": "2023-11-29T09:29:44Z",
"name": "csi-hostpath-sc",
"resourceVersion": "4616421",
"uid": "d56ed44f-4058-46ee-bf6f-4eada73ad184"
},
"provisioner": "hostpath.csi.k8s.io",
"reclaimPolicy": "Delete",
"volumeBindingMode": "Immediate"
}

kubectl version:
GitVersion:"v1.27.3"

kubectl get volumesnapshotclass -o json

{
"apiVersion": "v1",
"items": [
{
"apiVersion": "snapshot.storage.k8s.io/v1",
"deletionPolicy": "Delete",
"driver": "hostpath.csi.k8s.io",
"kind": "VolumeSnapshotClass",
"metadata": {
"annotations": {
"k10.kasten.io/is-snapshot-class": "true",
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"snapshot.storage.k8s.io/v1\",\"deletionPolicy\":\"Delete\",\"driver\":\"hostpath.csi.k8s.io\",\"kind\":\"VolumeSnapshotClass\",\"metadata\":{\"annotations\":{\"snapshot.storage.kubernetes.io/is-default-class\":\"true\"},\"name\":\"csi-hostpath-snapclass\"},\"parameters\":null}\n",
"snapshot.storage.kubernetes.io/is-default-class": "true"
},
"creationTimestamp": "2023-11-29T11:11:35Z",
"generation": 1,
"name": "csi-hostpath-snapclass",
"resourceVersion": "9434560",
"uid": "86bf9b21-2167-4275-9cb7-9d5284f5c57e"
}
}
],
"kind": "List",
"metadata": {
"resourceVersion": ""
}
}

 

Userlevel 7
Badge +22

Can you try creating a snapshot outside of Kasten.  https://kubernetes.io/docs/concepts/storage/volume-snapshots/

Userlevel 1

Can you try creating a snapshot outside of Kasten.  https://kubernetes.io/docs/concepts/storage/volume-snapshots/

 created without errors

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: csi-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: csi-hostpath-sc
----
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
name: new-snapshot-demo
spec:
volumeSnapshotClassName: csi-hostpath-snapclass
source:
persistentVolumeClaimName: csi-pvc

kubectl get  volumesnapshot

NAME                READYTOUSE   SOURCEPVC   SOURCESNAPSHOTCONTENT   RESTORESIZE   SNAPSHOTCLASS            SNAPSHOTCONTENT                                    CREATIONTIME   AGE
new-snapshot-demo   true         csi-pvc                             1Gi           csi-hostpath-snapclass   snapcontent-3525a074-fad5-4ef8-bef3-1504cc65604e   2m15s          4m16s


 

Badge

Hello,

A CSI driver that has Volume Snapshot support. Please look at the list of CSI drivers to confirm snapshot support.

 

Thank you,

Haythem

Comment