Issue information
found many error logs in rook-ceph. (open to see the example)
E0410 04:30:10.609529 1 reflector.go:140] github.com/kubernetes-csi/external-snapshotter/client/v6/informers/externalversions/factory.go:117: Failed to watch *v1.VolumeSnapshotClass: failed to list *v1.VolumeSnapshotClass: the server could not find the requested resource (get volumesnapshotclasses.snapshot.storage.k8s.io)
After searching from Internet. It seem reuest external-snapshotter must be installed.
Installing external-snapshotter
Follow the installation guide in https://github.com/kubernetes-csi/external-snapshotter?tab=readme-ov-file#usage
$ git clone https://github.com/kubernetes-csi/external-snapshotter
$ cd external-snapshotter
$ microk8s kubectl kustomize client/config/crd | microk8s kubectl create -f -
customresourcedefinition.apiextensions.k8s.io/volumegroupsnapshotclasses.groupsnapshot.storage.k8s.io created
customresourcedefinition.apiextensions.k8s.io/volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io created
customresourcedefinition.apiextensions.k8s.io/volumegroupsnapshots.groupsnapshot.storage.k8s.io created
customresourcedefinition.apiextensions.k8s.io/volumesnapshotclasses.snapshot.storage.k8s.io created
customresourcedefinition.apiextensions.k8s.io/volumesnapshotcontents.snapshot.storage.k8s.io created
customresourcedefinition.apiextensions.k8s.io/volumesnapshots.snapshot.storage.k8s.io created
$ microk8s kubectl -n kube-system kustomize deploy/kubernetes/snapshot-controller | microk8s kubectl create -f -
serviceaccount/snapshot-controller created
role.rbac.authorization.k8s.io/snapshot-controller-leaderelection created
clusterrole.rbac.authorization.k8s.io/snapshot-controller-runner created
rolebinding.rbac.authorization.k8s.io/snapshot-controller-leaderelection created
clusterrolebinding.rbac.authorization.k8s.io/snapshot-controller-role created
deployment.apps/snapshot-controller created
Since I have enable the hostpath StorageClass. Installing the sample hostpath CSI driver
# since my hostpath are installed in namespace kube-system
# update the namespace from default to kube-system
$ cd deploy/kubernetes/csi-snapshotter
$ grep "namespace: default" *.yaml
$ sed -i 's/namespace: default/namespace: kube-system/g' *.yaml
$ grep "namespace: kube-system" *.yaml
# add missing namespace setting in config files
# rbac-csi-snapshotter.yaml -> ServiceAccount/csi-snapshotter
# setup-csi-snapshotter.yaml -> Service/csi-snapshotter and StatefulSet/csi-snapshotter
$ nano rbac-csi-snapshotter.yaml
...
apiVersion: v1
kind: ServiceAccount
metadata:
name: csi-snapshotter
namespace: kube-system
...
$ naon setup-csi-snapshotter.yaml
...
kind: Service
apiVersion: v1
metadata:
name: csi-snapshotter
namespace: kube-system
...
kind: StatefulSet
apiVersion: apps/v1
metadata:
name: csi-snapshotter
namespace: kube-system
...
$ microk8s kubectl kustomize . | microk8s kubectl create -f -
serviceaccount/csi-provisioner created
serviceaccount/csi-snapshotter created
role.rbac.authorization.k8s.io/external-provisioner-cfg created
role.rbac.authorization.k8s.io/external-snapshotter-leaderelection created
clusterrole.rbac.authorization.k8s.io/external-provisioner-runner created
clusterrole.rbac.authorization.k8s.io/external-snapshotter-runner created
rolebinding.rbac.authorization.k8s.io/csi-provisioner-role-cfg created
rolebinding.rbac.authorization.k8s.io/csi-snapshotter-provisioner-role-cfg created
rolebinding.rbac.authorization.k8s.io/external-snapshotter-leaderelection created
clusterrolebinding.rbac.authorization.k8s.io/csi-provisioner-role created
clusterrolebinding.rbac.authorization.k8s.io/csi-snapshotter-provisioner-role created
clusterrolebinding.rbac.authorization.k8s.io/csi-snapshotter-role created
service/csi-snapshotter created
statefulset.apps/csi-snapshotter created
installing rook-ceph VolumeSnapshotClass
Follow the guide in document https://rook.io/docs/rook/v1.14/Storage-Configuration/Ceph-CSI/ceph-csi-snapshot/
ceph-rbd
$ microk8s kubectl create -f - << EOF
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata:
name: csi-rbdplugin-snapclass
driver: rook-ceph.rbd.csi.ceph.com # csi-provisioner-name
parameters:
# Specify a string that identifies your cluster. Ceph CSI supports any
# unique string. When Ceph CSI is deployed by Rook use the Rook namespace,
# for example "rook-ceph".
clusterID: rook-ceph # namespace:cluster
csi.storage.k8s.io/snapshotter-secret-name: rook-csi-rbd-provisioner
csi.storage.k8s.io/snapshotter-secret-namespace: rook-ceph # namespace:cluster
deletionPolicy: Delete
EOF
cephfs
$ microk8s kubectl create -f - << EOF
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata:
name: csi-cephfsplugin-snapclass
driver: rook-ceph.cephfs.csi.ceph.com # csi-provisioner-name
parameters:
# Specify a string that identifies your cluster. Ceph CSI supports any
# unique string. When Ceph CSI is deployed by Rook use the Rook namespace,
# for example "rook-ceph".
clusterID: rook-ceph # namespace:cluster
csi.storage.k8s.io/snapshotter-secret-name: rook-csi-cephfs-provisioner
csi.storage.k8s.io/snapshotter-secret-namespace: rook-ceph # namespace:cluster
deletionPolicy: Delete
EOF


發佈留言