How to Install the Linode Block Storage CSI Driver
Traducciones al EspañolEstamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
What is the Linode Block Storage CSI Driver?
The Container Storage Interface (CSI) defines a standard that storage providers can use to expose block and file storage systems to container orchestration systems. Linode’s Block Storage CSI driver follows this specification to allow container orchestration systems, like Kubernetes, to use Block Storage Volumes to persist data despite a Pod’s lifecycle. A Block Storage Volume can be attached to any Linode to provide additional storage.
Before You Begin
This guide assumes you have a working Kubernetes cluster running on Linode. If you have already created a Kubernetes cluster managed with
LKE, then the Block Storage CSI driver and the linode
secret token will already be pre-installed on your cluster. See the
Deploying Persistent Volume Claims with the Linode Block Storage CSI Driver guide for the next steps for working with Persistent Volume Claims.
If you are not using LKE or the Kubernetes Terraform installer, the Kubernetes cluster will require the Block Storage CSI driver to be installed on the cluster in order to use Linode’s Block Storage. If you need to set up an unmanaged Kubernetes cluster, you can follow the Getting Started with Kubernetes: Use kubeadm to Deploy a Cluster on Linode guide to do this.
The Linode Block Storage CSI driver absolutely requires that the Linode Cloud Controller Manager (CCM) is pre-installed and running on your cluster in order for the CSI to be installed. Follow the steps in our CCM installation guide before proceeding.
NoteThe Block Storage CSI supports Kubernetes version 1.13 or higher. To check the version of Kubernetes you are running, you can issue the following command:
kubectl version
Installing the CSI Driver
Create a Kubernetes Secret
A secret in Kubernetes is any token, password, or credential that you want Kubernetes to store for you. In the case of the Block Storage CSI, you want to store an API token, and for convenience, the region you would like your Block Storage Volume to be placed in.
NoteYour Block Storage Volume must be in the same data center as your Kubernetes cluster.
To create an API token:
Log into the Linode Cloud Manager.
Navigate to your account profile by clicking on your username at the top of the page and selecting My Profile. On mobile screen resolutions, this link is in the sidebar navigation.
Click on the API Tokens tab.
Click on Add a Personal Access Token. The Add Personal Access Token menu appears.
Provide a label for the token. This is how you reference your token within the Cloud Manager.
Set an expiration date for the token with the Expiry dropdown.
Set your permissions for the token. You need Read/Write access for Volumes, and Read/Write access for Linodes.
Click Submit.
Your access token appears on the screen. Copy this down somewhere safe, as once you click OK you can not retrieve the token again. If you lose it, forget it, or you think it may have become compromised, you need to create a new one.
Once you have your API token, it’s time to create your secret.
Run the following command to enter your token into memory:
read -s -p "Linode API Access Token: " LINODE_TOKEN
Press enter, and then paste in your API token.
Run the following command to enter your region into memory:
read -p "Linode Region of Cluster: " LINODE_REGION
You can retrieve a full list of regions by using the Linode CLI:
linode-cli regions list
For example, if you want to use the Newark, NJ, USA data center, you would use
us-east
as your region.Create the secret by piping in the following secret manifest to the
kubectl create
command. Issue the following command:cat <<EOF | kubectl create -f -
Now, paste in the following manifest and press enter:
apiVersion: v1 kind: Secret metadata: name: linode namespace: kube-system stringData: token: "$LINODE_TOKEN" region: "$LINODE_REGION" EOF
You can check to see if the command was successful by running the
get secrets
command in thekube-system
namespaces and looking forlinode
in the NAME column of the output:kubectl -n kube-system get secrets
You should see output similar to the following:
NAME TYPE DATA AGE ... job-controller-token-6zzkw kubernetes.io/service-account-token 3 43h kube-proxy-token-td7k8 kubernetes.io/service-account-token 3 43h linode Opaque 2 42h ...
You are now ready to install the Block Storage CSI driver.
Apply CSI Driver to your Cluster
To install the Block Storage CSI driver, use the apply
command and specify the following URL:
kubectl apply -f https://raw.githubusercontent.com/linode/linode-blockstorage-csi-driver/master/pkg/linode-bs/deploy/releases/linode-blockstorage-csi-driver.yaml
The above file concatenates a few files needed to run the Block Storage CSI driver, including the volume attachment, driver registration, and provisioning sidecars. To see these files individually, visit the project’s GitHub repository.
Next Steps
Once you have the Block Storage CSI driver installed, you are ready to provision a Persistent Volume Claim.
More Information
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
This page was originally published on