upcloud-csi

by Ankra

Helm chartv0.5.0App v1.5.1Apache-2.0Verified publisher

UpCloud CSI block-storage driver for Kubernetes (vendored from upstream v1.5.1) with snapshot backup CronJob, multi-zone StorageClasses, Prometheus alerts & Grafana dashboard.

About this chart

upcloud-csi

UpCloud CSI block-storage driver packaged as a Helm chart. Vendors the upstream UpCloud CSI v1.5.1 manifests (CRDs, RBAC, controller, node DaemonSet, snapshot controller, StorageClasses, and the optional snapshot validation webhook) and exposes them via a single helm install. The kubernetes-csi sidecars are the current upstream releases (csi-provisioner v6.4.0, csi-attacher v4.13.0, csi-resizer v2.3.0, csi-snapshotter and snapshot-controller v8.7.0, csi-node-driver-registrar v2.18.0), not the 2022 tags UpCloud's manifests still ship.

TL;DR

# 1. Install the CCM first (it creates the shared UpCloud credentials Secret).
helm install upcloud-ccm ./charts/upcloud-ccm -n kube-system \
  --set ccmConfig.clusterID="$(uuidgen)" \
  --set credentials.username="$UPCLOUD_USERNAME" \
  --set credentials.password="$UPCLOUD_PASSWORD"

# 2. Install the CSI driver - defaults reuse the CCM's Secret.
helm install upcloud-csi ./charts/upcloud-csi -n kube-system \
  --set storageClasses.defaultClass=maxiops

Or, if installing CSI standalone with its own credentials:

helm install upcloud-csi ./charts/upcloud-csi -n kube-system \
  --set credentials.create=true \
  --set credentials.existingSecret="" \
  --set credentials.username="$UPCLOUD_USERNAME" \
  --set credentials.password="$UPCLOUD_PASSWORD" \
  --set storageClasses.defaultClass=maxiops

What's included

ResourceSourceNotes
CSIDriver/storage.csi.upcloud.comupstreamattachRequired=true, podInfoOnMount=true, fsGroupPolicy=File.
StatefulSet/<release>-upcloud-csi-controllerupstreamcsi-provisioner + csi-attacher + csi-resizer + csi-snapshotter + csi-upcloud-plugin. Leader election on each sidecar.
Deployment/<release>-upcloud-csi-snapshot-controllerupstreamExternal snapshot-controller. Two replicas + PDB by default.
DaemonSet/<release>-upcloud-csi-nodeupstreamcsi-node-driver-registrar + csi-upcloud-plugin. Privileged plugin (required for mount syscalls).
StorageClass × 3upstream + extendedupcloud-block-storage-maxiops, …-standard, …-hdd. Per-class enable flag, default-class annotation toggle, allowedTopologies, mountOptions, per-tier reclaimPolicy / volumeBindingMode.
VolumeSnapshotClass × 1-2upstream + extendedDefault Delete policy SC, optional Retain policy SC.
RBACupstreamServiceAccounts, ClusterRoles, ClusterRoleBindings, leader-election Role.
Job (post-install hook)chartPatches the chosen UpCloud SC as cluster default and clears K3s' local-path default.
CronJob + scoped RBACchartOpt-in periodic VolumeSnapshot creation with PVC/namespace label selectors and retention rotation (snapshotCronJob.enabled).
PodMonitor / PrometheusRule / Grafana dashboard ConfigMapchartOpt-in observability (metrics.* / dashboard.*).
Pod + PVC (helm test)chartEnd-to-end provision/mount/write test (tests.enabled).
ValidatingWebhookConfiguration + webhook DeploymentupstreamOpt-in (snapshotWebhook.enabled=true).
CRDs under crds/upstreamVolumeSnapshot, VolumeSnapshotClass, VolumeSnapshotContent. Annotated helm.sh/resource-policy: keep (survive helm uninstall).

Requirements

RequirementNotes
Kubernetes>= 1.34 (enforced by Chart.yaml's kubeVersion; external-provisioner v6's minimum). Chart 0.4.x serves older clusters.
UpCloud CCMRecommended (provides node UUID annotations the CSI driver relies on). Install upcloud-ccm first.
UpCloud API credentialsReused from upcloud-ccm-created Secret by default; can be supplied directly.
Snapshot Controller external CRDsBundled in crds/. No external snapshot-controller install needed - the chart ships one.

Sharing credentials with upcloud-ccm

The chart defaults to reusing the Secret created by helm install upcloud-ccm:

credentials:
  existingSecret: "upcloud-ccm-credentials"   # default
  create: false

If your CCM release is named differently, override the Secret name accordingly:

helm install upcloud-csi ./charts/upcloud-csi -n kube-system \
  --set credentials.existingSecret=ccm-prod-credentials \
  --set storageClasses.defaultClass=maxiops

Default StorageClass

storageClasses.defaultClass accepts "", "maxiops", "standard", or "hdd". When set, the chart:

  1. Stamps storageclass.kubernetes.io/is-default-class: "true" on the chosen StorageClass template.
  2. Runs a post-install / post-upgrade Helm hook Job (<release>-upcloud-csi-default-sc) that:
    • Removes the default flag from K3s' built-in local-path SC (if present and disableLocalPathDefault: true, the default).
    • Marks the chosen UpCloud SC as the cluster default.

The hook has its own scoped RBAC (storageclasses: get/list/patch) created in the same post-install,post-upgrade event at a lower hook-weight, so it exists for the Job's pod and is replaced on the next run (before-hook-creation).

Air-gapped installs

Mirror every image into a private registry, then override:

global:
  imageRegistry: harbor.internal

images:
  csiDriver:
    repository: mirror/upcloudltd/upcloud-csi
    digest: sha256:<via `crane digest`>
  provisioner:
    repository: mirror/sig-storage/csi-provisioner
    digest: sha256:...
  # …and so on for every image.

imagePullSecrets:
  - name: harbor-pull-secret

See values-examples/air-gapped.yaml.

Snapshot validation webhook (optional, deprecated)

Since external-snapshotter v8.0 the snapshot CRDs validate VolumeSnapshots and VolumeSnapshotContents with CEL rules; the webhook only checks that each driver has at most one default VolumeSnapshotClass, and upstream removed it in v8.2. The chart runs its last image, v8.1.1. Off by default because it requires a TLS cert. To enable:

  1. Provision a TLS Secret named snapshot-validation-secret in the chart namespace (e.g. via cert-manager) with cert.pem / key.pem valid for the Service DNS names snapshot-validation-service.<ns>.svc[.cluster.local].
  2. helm upgrade upcloud-csi ./charts/upcloud-csi --set snapshotWebhook.enabled=true.

Snapshots & backups

Two VolumeSnapshotClasses

The chart can render two snapshot classes, controlled independently:

ClassToggledeletionPolicyUse case
upcloud-csi-snapshotclasssnapshotClasses.delete.enabled (default true)DeleteApplication-level snapshots, ephemeral test clones - UpCloud snapshot disappears when the K8s VolumeSnapshot is removed.
upcloud-csi-snapshotclass-retainsnapshotClasses.retain.enabledRetainCompliance / pre-migration archives - UpCloud snapshot survives even if the VolumeSnapshot object is deleted.

Mark one as the cluster default with snapshotClasses.<name>.isDefault: true.

Periodic backup CronJob

Enable the bundled CronJob to snapshot every UpCloud-backed PVC on a schedule:

helm upgrade upcloud-csi ./charts/upcloud-csi -n kube-system \
  -f values-examples/backup-cronjob.yaml

Key knobs (see values-examples/backup-cronjob.yaml):

ValueDefaultNotes
snapshotCronJob.enabledfalseMaster switch.
snapshotCronJob.schedule0 2 * * *Standard cron syntax.
snapshotCronJob.timeZoneEtc/UTCKubernetes 1.27+.
snapshotCronJob.pvcLabelSelector""E.g. backup.ankra.io/enabled=true to opt in PVCs explicitly.
snapshotCronJob.namespaceLabelSelector""Restrict to namespaces (e.g. app.kubernetes.io/managed-by=Helm).
snapshotCronJob.snapshotClassupcloud-csi-snapshotclassSwitch to …-retain for archive-style backups.
snapshotCronJob.retentionCount7Keep N most recent snapshots per PVC. 0 disables rotation.
snapshotCronJob.dryRunfalseWhen true, only log what would happen.

The CronJob's RBAC is locked down to: pvc/namespace get,list and volumesnapshot get,list,create,delete.

Restoring from a snapshot

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-restored-pvc
  namespace: default
spec:
  storageClassName: upcloud-block-storage-maxiops
  dataSource:
    name: <existing-volumesnapshot-name>
    kind: VolumeSnapshot
    apiGroup: snapshot.storage.k8s.io
  accessModes: [ReadWriteOnce]
  resources:
    requests:
      storage: 10Gi

Multi-zone clusters

UpCloud block storage is zone-bound - a fi-hel1 volume cannot be attached to a fi-hel2 VM - and the driver creates volumes only in the zone its controller runs in, rejecting any other zone it is asked for.

The driver reports its topology under the key region (the node's zone), and kubelet labels every node running the node plugin with it. csi-provisioner v5+ acts on that: each new PersistentVolume gets a region In [<zone>] node affinity, so pods follow their volumes. Any allowedTopologies must therefore use the region key; a class keyed on topology.kubernetes.io/zone fails every WaitForFirstConsumer claim with topology ... from selected node ... is not in requisite.

For a cluster with nodes in several zones, pin the controller and every StorageClass to one zone with WaitForFirstConsumer:

helm upgrade upcloud-csi ./charts/upcloud-csi -n kube-system \
  -f values-examples/multi-zone.yaml

controller.sidecarExtraArgs.provisioner: ["--feature-gates=Topology=false"] turns topology off again (the csi-provisioner v3 behaviour): PVs carry no node affinity and every volume lands in the controller's zone.

Observability

ResourceTogglePurpose
PodMonitormetrics.podMonitor.enabledPrometheus Operator scrapes the controller + node CSI plugin metrics.
PrometheusRulemetrics.prometheusRule.enabledRecommended alerts (see below).
Grafana dashboarddashboard.enabledConfigMap auto-discovered by the kube-prometheus-stack Grafana sidecar.

Bundled alerts

AlertSeverityTrigger
UpCloudCSIControllerDowncriticalStatefulSet Ready < expected replicas, sustained 5m.
UpCloudCSINodeMissingwarningDaemonSet pod absent on one or more nodes for 10m.
UpCloudCSIPVCPendingwarningPVC bound against an upcloud-block-storage-* SC stays Pending >15m.
UpCloudCSISnapshotControllerDownwarningSnapshot controller Deployment has 0 Available replicas for 10m.
UpCloudCSIVolumeNearFullwarningused/capacity > 0.85 (configurable) for >15m.
UpCloudCSIPodCrashLoopingcritical>3 restarts in 15m.

See values-examples/observability.yaml for a full kube-prometheus-stack-compatible overlay (alert label release: kube-prometheus-stack, dashboard sidecar label grafana_dashboard: "1").

Troubleshooting

SymptomCauseResolution
PVC stuck PendingUpCloud API quota / region mismatch / controller downkubectl describe pvc … and kubectl logs -n kube-system <controller-pod> -c csi-upcloud-plugin.
Pod stuck ContainerCreating: MountVolume.MountDevice failedNode DaemonSet not running on that node, or kubelet root mismatchVerify kubectl get pods -l app.kubernetes.io/component=node covers every node; check node.kubeletDir.
helm test upcloud-csi failsProvisioner/attacher cannot reach UpCloud (credentials/quota)Inspect the test pod events; check Secret data.
Snapshots fail to createSnapshot controller down / VolumeSnapshotClass missingVerify CRDs installed and the snapshot-controller Deployment is Ready.
VolumeSnapshot stays ReadyToUse=falseUpCloud API rate-limit on snapshot createReduce concurrent snapshots in the CronJob, or wait - the snapshot eventually completes.

Helm test

After install, run:

helm test upcloud-csi -n kube-system

The test creates a small PVC (default 10Gi) against the maxiops SC, mounts it in a busybox pod, writes 4MiB of random data, reads it back, and deletes the test resources. Set tests.enabled=false to skip rendering the test pod entirely.

Upgrade story

Bumping the bundled UpCloud CSI version

The chart vendors a pinned upstream snapshot. To bump:

# Local
./charts/scripts/sync-upstream.sh csi v1.5.1
helm lint charts/upcloud-csi
git diff charts/upcloud-csi/

The daily .github/workflows/charts-upcloud-sync.yml workflow does this automatically and opens a PR.

Upgrading the chart

Read CHANGELOG.md first: 0.5.0 crosses majors on every kubernetes-csi sidecar, requires Kubernetes 1.34, and turns on topology-aware provisioning. A stack that overrides images.<sidecar>.tag keeps those tags until the overrides are removed.

helm upgrade upcloud-csi ./charts/upcloud-csi -n kube-system -f my-values.yaml

CRDs under crds/ are installed only on the first helm install and never deleted (per Helm 3 semantics + helm.sh/resource-policy: keep). To pick up upstream CRD changes, run:

kubectl replace -f charts/upcloud-csi/crds/

Uninstall

helm uninstall upcloud-csi -n kube-system

The CRDs and any existing VolumeSnapshot / VolumeSnapshotContent resources will survive uninstall by design. To remove them too:

kubectl delete crd volumesnapshots.snapshot.storage.k8s.io \
                  volumesnapshotclasses.snapshot.storage.k8s.io \
                  volumesnapshotcontents.snapshot.storage.k8s.io

Configuration reference

A full table of values lives in [values.yaml](

Deploy upcloud-csi with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has upcloud-csi on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartupcloud-csi is pinned at v0.5.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply