66-Deploy Harvester csi driver to k3s Cluster

  • Related task: #2755 Steps to manually install Harvester csi-driver on K3s cluster

Reference Document

Deploying with Harvester K3s Node Driver

Verify steps

  1. Prepare a Harvester cluster with enough cpu, memory and disks for K3s guest cluster

  2. Create a Rancher instance

  3. Import Harvester in Rancher and create cloud credential

  4. ssh to Harvester management node

  5. Extract the kubeconfig of Harvester with cat /etc/rancher/rke2/rke2.yaml

  6. Change the server value from https://127.0.0.1:6443/ to your VIP

  7. Copy the kubeconfig and add into your local ~/.kube/config file

  8. Import Harvester in Rancher

  9. Create cloud credential

  10. Provision a k3s cluster image

  11. Provide the login credential in user data

    password: 123456
    chpasswd: { expire: False }
    ssh_pwauth: True
    
  12. On K3s, by default will not provide cloud-provider image

  13. Check k3s cluster provisioning in Ready image

  14. Use the new generate_cloud_provider_config.sh to generate cloud-config content for csi-driver

    ./generate_cloud_provider_config.sh <serviceaccount name> <namespace>
    
    e.g ./generate_cloud_provider_config.sh k3s default
    
  15. ssh to the k3s guest cluster vm

  16. Create the config-files directory

    mkdir -p /var/lib/rancher/rke2/etc/config-files
    
  17. Add the cloud-provider-config file from the cloud-config part of output generated from script

    vim /var/lib/rancher/rke2/etc/config-files/cloud-provider-config
    
  18. Access k3s guest cluster on Rancher

  19. Switch to All Namespace

  20. Open Apps -> Charts

  21. Install Harvester CSI Driver from the Rancher marketplace. You do not need to change the cloud-config path. image

  22. Open Storage -> StorageClasses

  23. PersistentVolumeClaims page

  24. Create a PVC named test-pvc, select Harvester in the Storage Class image

Expected Results

  1. Check can successfully install csi-driver on Installed Apps image

  2. Check Harvester set to the default storage class image

  3. Check the test-pvc exists on PersistentVolumeClaims page

  4. Check a new pv created on PersistentVolumes

  5. Check the created pv also exists on Harvester Volumes page