linode / linode-blockstorage-csi-driver

Container Storage Interface (CSI) Driver for Linode Block Storage
Apache License 2.0
66 stars 55 forks source link

Kubernetes 1.22 - no matches for kind "CSIDriver" #78

Closed MihaiSandor closed 2 years ago

MihaiSandor commented 2 years ago

Expected Behavior

Succesfull installation

Actual Behavior

error: unable to recognize "https://raw.githubusercontent.com/linode/linode-blockstorage-csi-driver/master/pkg/linode-bs/deploy/releases/linode-blockstorage-csi-driver.yaml": no matches for kind "CSIDriver" in version "storage.k8s.io/v1beta1"

Steps to Reproduce the Problem

  1. Login to my kubernetes cluster in Linode
  2. kubectl apply -f https://raw.githubusercontent.com/linode/linode-blockstorage-csi-driver/master/pkg/linode-bs/deploy/releases/linode-blockstorage-csi-driver.yaml

Screenshots, Code Blocks, and Logs

kubectl apply -f https://raw.githubusercontent.com/linode/linode-blockstorage-csi-driver/master/pkg/linode-bs/deploy/releases/linode-blockstorage-csi-driver.yaml storageclass.storage.k8s.io/linode-block-storage unchanged storageclass.storage.k8s.io/linode-block-storage-retain unchanged serviceaccount/csi-controller-sa unchanged serviceaccount/csi-node-sa unchanged clusterrole.rbac.authorization.k8s.io/linode-csi-role unchanged clusterrole.rbac.authorization.k8s.io/external-attacher-role unchanged clusterrole.rbac.authorization.k8s.io/external-provisioner-role unchanged clusterrole.rbac.authorization.k8s.io/external-resizer-role unchanged clusterrolebinding.rbac.authorization.k8s.io/linode-csi-binding unchanged clusterrolebinding.rbac.authorization.k8s.io/csi-controller-attacher-binding unchanged clusterrolebinding.rbac.authorization.k8s.io/csi-controller-provisioner-binding unchanged clusterrolebinding.rbac.authorization.k8s.io/csi-controller-resizer-binding unchanged configmap/get-linode-id unchanged statefulset.apps/csi-linode-controller configured daemonset.apps/csi-linode-node unchanged error: unable to recognize "https://raw.githubusercontent.com/linode/linode-blockstorage-csi-driver/master/pkg/linode-bs/deploy/releases/linode-blockstorage-csi-driver.yaml": no matches for kind "CSIDriver" in version "storage.k8s.io/v1beta1"

thedotedge commented 2 years ago

Same issue after forced upgrade to LKE 1.23.

srust commented 2 years ago

Hi, for LKE clusters, applying the linode CSI driver by hand is not required. LKE includes the linode block storage driver by default. This is part of the managed LKE service.

So if you are using an LKE cluster, you can simply create PVCs and block storage volumes will be created to fulfill those claims.

if you have deployed kubernetes directly on to linode VMs (via rancher linode plugins or otherwise), then that is what this plugin is useful for, to add block storage capabilities to those clusters.

As of kubernetes 1.18 the CSIDriver resource is built-in to the API and is no longer in beta. I suspect 1.22 has removed the beta versions of the API and that is why this is no longer working.

To apply this correctly, the following patch will work:

diff --git a/pkg/linode-bs/deploy/releases/linode-blockstorage-csi-driver.yaml b/pkg/linode-bs/deploy/releases/linode-blockstorage-csi-driver.yaml
index 242ac9b..13250a7 100644
--- a/pkg/linode-bs/deploy/releases/linode-blockstorage-csi-driver.yaml
+++ b/pkg/linode-bs/deploy/releases/linode-blockstorage-csi-driver.yaml
@@ -554,7 +554,7 @@ spec:
           type: Directory
         name: sys
 ---
-apiVersion: storage.k8s.io/v1beta1
+apiVersion: storage.k8s.io/v1
 kind: CSIDriver
 metadata:
   name: linodebs.csi.linode.com

Will update this in the next release.

Again, this is not required for LKE clusters as the functionality provided by this repo is automatically included in LKE clusters.

Thanks for the report.

srust commented 2 years ago

The deprecation of v1beta in favor of v1 is documented here:

https://kubernetes.io/docs/reference/using-api/deprecation-guide/#storage-resources-v122

srust commented 2 years ago

This is fixed by #84

rovaniemi commented 1 year ago

In the latest update, this change has been withdrawn. Was there a specific reason for this @srust?

https://github.com/linode/linode-blockstorage-csi-driver/commit/4101d8517c9e5e6281de517c860d17fc3f263e3e#diff-8d3664375a0e74ade8c2851454cfd0f8ec2eae83551d413f39dbfbbe2b9f8068L562