Install the CSI driver
- License Secret (License) in the namespace created in Prepare the Kubernetes cluster:
Terminal window kubectl -n csi-hyperv create secret generic hypervcsi-license --from-file=license.lic=./license.lic - Values file
my-values.yaml(minimal; the chart’svalues.yamllists everything):Do not addglobal:imageTag: <version> # same version as the WebApiimagePullSecrets: [ { name: ghcr-regcred } ]license:existingSecret: hypervcsi-licensehypervcsicontroller:enabled: trueenvironment:- { name: ASPNETCORE_ENVIRONMENT, value: Production }- { name: Kestrel__EndPoints__UnixSocket__Url, value: "http://unix:/csi/csi.sock" }- { name: Kestrel__EndPoints__UnixSocket__Protocols, value: Http2 }- { name: K8sHypervServices__Mode, value: Http }- { name: K8sHypervServices__Http__ApiUrl, value: "http://<webapi-host>:8081" }- { name: K8sHypervServices__Http__ApiToken, value: "<ApiSettings:ApiToken of the WebApi>" }hypervcsinodedriver:enabled: trueenvironment:- { name: ASPNETCORE_ENVIRONMENT, value: Production }- { name: Kestrel__EndPoints__UnixSocket__Url, value: "http://unix:/csi/csi.sock" }- { name: Kestrel__EndPoints__UnixSocket__Protocols, value: Http2 }- { name: K8sHypervServices__Mode, value: Http }- { name: K8sHypervServices__Http__ApiUrl, value: "http://<webapi-host>:8081" }- { name: K8sHypervServices__Http__ApiToken, value: "<same token>" }Kestrel__EndPoints__Http__Url: the CSI gRPC endpoints must stay on the Unix socket (they are unauthenticated). Keep the API token out of Git (SOPS, sealed secrets, orvalueFromwith your own Secret). - Install:
The chart also creates the cluster-scoped
Terminal window git clone https://github.com/baremetal-works/hypervcsi-helm.githelm install hypervcsi ./hypervcsi-helm/charts/hypervcsi -n csi-hyperv -f my-values.yamlCSIDriverobjecteu.nova.csi.hyperv. - StorageClass:
apiVersion: storage.k8s.io/v1kind: StorageClassmetadata:name: hyperv-vstore1provisioner: eu.nova.csi.hypervparameters:hostname: hv-cluster-01.example.com # required: cluster FQDN (Clusters[].Name + Domain) or a node FQDNstore: VStore1 # CSV name; the Default store when omittedvhdType: Dynamic # Dynamic (default) or Fixedcsi.storage.k8s.io/fstype: ext4 # ext4 (default), xfs or ext3# logicalSectorSize / physicalSectorSize: default 4096reclaimPolicy: DeletevolumeBindingMode: ImmediateallowVolumeExpansion: true # needs the CAN_RESIZE license feature
Verify
Section titled “Verify”kubectl -n csi-hyperv get pods # controller 4/4 (5/5 with the health monitor), one node driver per nodekubectl get csidriver eu.nova.csi.hypervkubectl apply -f - <<'EOF'apiVersion: v1kind: PersistentVolumeClaimmetadata: { name: hyperv-test }spec: accessModes: [ReadWriteOnce] storageClassName: hyperv-vstore1 resources: { requests: { storage: 1Gi } }---apiVersion: v1kind: Podmetadata: { name: hyperv-test }spec: containers: - { name: c, image: busybox:1.36, command: [sh, -c, "echo ok > /data/ok && sleep 3600"], volumeMounts: [ { name: d, mountPath: /data } ] } volumes: [ { name: d, persistentVolumeClaim: { claimName: hyperv-test } } ]EOFkubectl wait pod/hyperv-test --for=condition=Ready --timeout=180skubectl exec hyperv-test -- df -h /datakubectl delete pod/hyperv-test pvc/hyperv-test # the VHDX is detached and deleted from the CSV