upcloud-csi
by Ankra
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
| Resource | Source | Notes |
|---|---|---|
CSIDriver/storage.csi.upcloud.com | upstream | attachRequired=true, podInfoOnMount=true, fsGroupPolicy=File. |
StatefulSet/<release>-upcloud-csi-controller | upstream | csi-provisioner + csi-attacher + csi-resizer + csi-snapshotter + csi-upcloud-plugin. Leader election on each sidecar. |
Deployment/<release>-upcloud-csi-snapshot-controller | upstream | External snapshot-controller. Two replicas + PDB by default. |
DaemonSet/<release>-upcloud-csi-node | upstream | csi-node-driver-registrar + csi-upcloud-plugin. Privileged plugin (required for mount syscalls). |
StorageClass × 3 | upstream + extended | upcloud-block-storage-maxiops, …-standard, …-hdd. Per-class enable flag, default-class annotation toggle, allowedTopologies, mountOptions, per-tier reclaimPolicy / volumeBindingMode. |
VolumeSnapshotClass × 1-2 | upstream + extended | Default Delete policy SC, optional Retain policy SC. |
| RBAC | upstream | ServiceAccounts, ClusterRoles, ClusterRoleBindings, leader-election Role. |
Job (post-install hook) | chart | Patches the chosen UpCloud SC as cluster default and clears K3s' local-path default. |
CronJob + scoped RBAC | chart | Opt-in periodic VolumeSnapshot creation with PVC/namespace label selectors and retention rotation (snapshotCronJob.enabled). |
PodMonitor / PrometheusRule / Grafana dashboard ConfigMap | chart | Opt-in observability (metrics.* / dashboard.*). |
Pod + PVC (helm test) | chart | End-to-end provision/mount/write test (tests.enabled). |
ValidatingWebhookConfiguration + webhook Deployment | upstream | Opt-in (snapshotWebhook.enabled=true). |
CRDs under crds/ | upstream | VolumeSnapshot, VolumeSnapshotClass, VolumeSnapshotContent. Annotated helm.sh/resource-policy: keep (survive helm uninstall). |
Requirements
| Requirement | Notes |
|---|---|
| Kubernetes | >= 1.34 (enforced by Chart.yaml's kubeVersion; external-provisioner v6's minimum). Chart 0.4.x serves older clusters. |
| UpCloud CCM | Recommended (provides node UUID annotations the CSI driver relies on). Install upcloud-ccm first. |
| UpCloud API credentials | Reused from upcloud-ccm-created Secret by default; can be supplied directly. |
| Snapshot Controller external CRDs | Bundled 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:
- Stamps
storageclass.kubernetes.io/is-default-class: "true"on the chosen StorageClass template. - Runs a post-install / post-upgrade Helm hook Job
(
<release>-upcloud-csi-default-sc) that:- Removes the default flag from K3s' built-in
local-pathSC (if present anddisableLocalPathDefault: true, the default). - Marks the chosen UpCloud SC as the cluster default.
- Removes the default flag from K3s' built-in
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:
- Provision a TLS Secret named
snapshot-validation-secretin the chart namespace (e.g. via cert-manager) withcert.pem/key.pemvalid for the Service DNS namessnapshot-validation-service.<ns>.svc[.cluster.local]. helm upgrade upcloud-csi ./charts/upcloud-csi --set snapshotWebhook.enabled=true.
Snapshots & backups
Two VolumeSnapshotClasses
The chart can render two snapshot classes, controlled independently:
| Class | Toggle | deletionPolicy | Use case |
|---|---|---|---|
upcloud-csi-snapshotclass | snapshotClasses.delete.enabled (default true) | Delete | Application-level snapshots, ephemeral test clones - UpCloud snapshot disappears when the K8s VolumeSnapshot is removed. |
upcloud-csi-snapshotclass-retain | snapshotClasses.retain.enabled | Retain | Compliance / 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):
| Value | Default | Notes |
|---|---|---|
snapshotCronJob.enabled | false | Master switch. |
snapshotCronJob.schedule | 0 2 * * * | Standard cron syntax. |
snapshotCronJob.timeZone | Etc/UTC | Kubernetes 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.snapshotClass | upcloud-csi-snapshotclass | Switch to …-retain for archive-style backups. |
snapshotCronJob.retentionCount | 7 | Keep N most recent snapshots per PVC. 0 disables rotation. |
snapshotCronJob.dryRun | false | When 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
| Resource | Toggle | Purpose |
|---|---|---|
PodMonitor | metrics.podMonitor.enabled | Prometheus Operator scrapes the controller + node CSI plugin metrics. |
PrometheusRule | metrics.prometheusRule.enabled | Recommended alerts (see below). |
| Grafana dashboard | dashboard.enabled | ConfigMap auto-discovered by the kube-prometheus-stack Grafana sidecar. |
Bundled alerts
| Alert | Severity | Trigger |
|---|---|---|
UpCloudCSIControllerDown | critical | StatefulSet Ready < expected replicas, sustained 5m. |
UpCloudCSINodeMissing | warning | DaemonSet pod absent on one or more nodes for 10m. |
UpCloudCSIPVCPending | warning | PVC bound against an upcloud-block-storage-* SC stays Pending >15m. |
UpCloudCSISnapshotControllerDown | warning | Snapshot controller Deployment has 0 Available replicas for 10m. |
UpCloudCSIVolumeNearFull | warning | used/capacity > 0.85 (configurable) for >15m. |
UpCloudCSIPodCrashLooping | critical | >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
| Symptom | Cause | Resolution |
|---|---|---|
PVC stuck Pending | UpCloud API quota / region mismatch / controller down | kubectl describe pvc … and kubectl logs -n kube-system <controller-pod> -c csi-upcloud-plugin. |
Pod stuck ContainerCreating: MountVolume.MountDevice failed | Node DaemonSet not running on that node, or kubelet root mismatch | Verify kubectl get pods -l app.kubernetes.io/component=node covers every node; check node.kubeletDir. |
helm test upcloud-csi fails | Provisioner/attacher cannot reach UpCloud (credentials/quota) | Inspect the test pod events; check Secret data. |
| Snapshots fail to create | Snapshot controller down / VolumeSnapshotClass missing | Verify CRDs installed and the snapshot-controller Deployment is Ready. |
VolumeSnapshot stays ReadyToUse=false | UpCloud API rate-limit on snapshot create | Reduce 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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartupcloud-csi is pinned at v0.5.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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