Skip to content

Error when importing snapshots #94

@hakanmemisoglu

Description

@hakanmemisoglu

Hi,

I have a problem with importing snapshots to Kubernetes. I managed to create a custom Kubernetes Cluster (version 1.13 and the nodes are VMs from Google Cloud) with GPD CSI driver (version DEV where it uses external provisioner, snapshotter v1.0.1) installed. I was able to provision volumes, create snapshots and restore volumes from snapshots.

Next, I decided to import existing snapshots that I am keeping in Google Cloud. After reading https://kubernetes.io/blog/2018/10/09/introducing-volume-snapshot-alpha-for-kubernetes/, the section Importing an existing snapshot with Kubernetes, I started to import my existing snapshots in Google Cloud, with the method explained in the blog post.

Here are the steps that I applied:

I created a VolumeSnapshotContent with:

$ cat <<EOF | kubectl create -f - 
apiVersion: snapshot.storage.k8s.io/v1alpha1
kind: VolumeSnapshotContent
metadata:
  name: imported-snap-content
spec:
  csiVolumeSnapshotSource:
    driver: pd.csi.storage.gke.io
    snapshotHandle: {GCP_SNAP_ID}
  volumeSnapshotRef:
    kind: VolumeSnapshot
    name: imported-snap
    namespace: temp-namespace
EOF

After that, I created a VolumeSnapshot with the same reference I used in VolumeSnapshotContent:

$ cat << EOF | kubectl create -f -
apiVersion: snapshot.storage.k8s.io/v1alpha1
kind: VolumeSnapshot
metadata:
  name: imported-snap
  namespace: temp-namespace
spec:
  snapshotClassName: default-snapshot-class
  snapshotContentName: imported-snap-content
EOF

default-snapshot-class is the VolumeSnapshotClass from https://github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver/blob/master/examples/kubernetes/demo-defaultsnapshotclass.yaml

So, I checked the VolumeSnapshotContent first:

$ kubectl get volumesnapshotcontent imported-snap-content -oyaml
apiVersion: snapshot.storage.k8s.io/v1alpha1
kind: VolumeSnapshotContent
metadata:
  creationTimestamp: 2019-02-15T18:31:47Z
  finalizers:
  - snapshot.storage.kubernetes.io/volumesnapshotcontent-protection
  generation: 3
  name: imported-snap-content
  resourceVersion: "475063"
  selfLink: /apis/snapshot.storage.k8s.io/v1alpha1/volumesnapshotcontents/imported-snap-content
  uid: f399dfcc-314f-11e9-b4da-42010a8a004e
spec:
  csiVolumeSnapshotSource:
    driver: pd.csi.storage.gke.io
    snapshotHandle: {GCP-SNAP-ID}
  deletionPolicy: null
  persistentVolumeRef: null
  snapshotClassName: default-snapshot-class
  volumeSnapshotRef:
    kind: VolumeSnapshot
    name: imported-snap
    namespace: temp-namespace
    uid: f861fa81-314f-11e9-b4da-42010a8a004e

It looks like the snapshot controller managed to bind it to a VolumeSnapshot since uid field in volumeSnapshotRef is filled.

Then, I looked the details of VolumeSnapshot that I created before:

$ kubectl get volumesnapshot  imported-snap -n temp-namespace -oyaml 
apiVersion: snapshot.storage.k8s.io/v1alpha1
kind: VolumeSnapshot
metadata:
  creationTimestamp: 2019-02-15T18:31:55Z
  finalizers:
  - snapshot.storage.kubernetes.io/volumesnapshot-protection
  generation: 3
  name: imported-snap
  namespace: temp-namespace
  resourceVersion: "475064"
  selfLink: /apis/snapshot.storage.k8s.io/v1alpha1/namespaces/temp-namespace/volumesnapshots/imported-snap
  uid: f861fa81-314f-11e9-b4da-42010a8a004e
spec:
  snapshotClassName: default-snapshot-class
  snapshotContentName: imported-snap-content
  source: null
status:
  creationTime: null
  error:
    message: 'Failed to check and update snapshot: failed to get input parameters
      to create snapshot imported-snap: "the snapshot source is not specified."'
    time: 2019-02-15T18:31:55Z
  readyToUse: false
  restoreSize: null

The UID matches with the one in the reference. However, the controller registers a problem saying that source is not specified. When I look at the API detail, I see that source is a field for recording the originated volume in Kubernetes Cluster. It is interesting since I didn’t create a snapshot from a PVC, but I was trying to import a snapshot. In this case, I expect a null source is the normal thing.

What can I do to solve this problem? Are there some steps that I couldn’t do properly or am I missing some steps?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions