AutoScaler on Kubernetes
Learn how Datafy AutoScaler integrates with the AWS EBS CSI driver: what gets installed, how volume requests are translated, and what happens after uninstall
When a volume is autoscaling, the original EBS volume is replaced by smaller Datafy-managed volumes. In a Kubernetes cluster, the PersistentVolume that represents this volume still references the original volume ID. Whenever the matching PersistentVolumeClaim requires an action at the volume level (such as attaching, mounting, or detaching), the AWS EBS CSI driver, which handles EBS volume operations in Kubernetes, cannot find the correct volume to act on.
Datafy bridges this gap with a conversion layer that intercepts requests received by the CSI driver and translates them to the underlying Datafy-managed volumes. For volumes Datafy does not manage, requests pass through unchanged.
Installing Datafy on Kubernetes
Installing AutoScaler on a Kubernetes cluster adds three main components to your cluster:
Datafy agent —
datafy-agentDaemonSet, with one pod per node. Performs the same functions as in non-Kubernetes environments: monitoring utilization, orchestrating grow and shrink operations, and managing the virtualization layer.Datafy controller —
datafy-controllerDeployment. Tracks volume state and manages the integration with the CSI driver.Datafy proxy —
datafy-proxysidecar container added to eachebs-csi-controllerandebs-csi-nodepod. Intercepts and translates CSI driver requests for managed volumes.
The Datafy proxy sidecar is added to CSI driver pods through a Kubernetes admission webhook that the controller registers. The webhook adds the sidecar whenever a CSI driver pod starts, whether on initial install, version upgrade, or routine restart, so the integration is preserved across CSI driver updates without manual reconfiguration. The controller also re-adds the sidecar if the ebs-csi-controller Deployment or ebs-csi-node DaemonSet drifts.
Volume Operations
The cluster operations you'd typically perform on autoscaling volumes work the same as on any other PersistentVolume: the Datafy proxy translates each request to the underlying volumes, and the standard CSI driver carries out the AWS calls using its existing IAM credentials.
Pod rescheduling — when a pod moves between nodes during a drain, rolling update, eviction, or rescaling, the CSI sidecar translates the detach and re-attach calls, and the Datafy agent on each node tears down or sets up the virtualization layer. From the application's perspective, this is identical to a standard pod rescheduling event.
Snapshots and backups — Kubernetes
VolumeSnapshotresources are supported, including the CSI snapshotter integration used by tools like Velero. For details, see Datafy Snapshots.New autoscaling PVCs — when a PVC requests an autoscaling volume, the Datafy proxy creates it through Datafy instead of passing the request to the CSI driver, so the PVC is bound to an autoscaling volume from the start. For details, see Creating Autoscaling Volumes.
Bottlerocket Local Volumes
On nodes running Bottlerocket, the Datafy app shows Bottlerocket's data volume as a local volume, named after its /local mount path. The volume is created when the node launches, from the node's block device mapping (device /dev/xvdb by default), so it isn't a PersistentVolume and the operations above don't apply to it.
Activating autoscaling — a local volume can't be created as autoscaling. Activate it with an autoscaling rule.
Changing size, IOPS, or throughput — modifying a local volume isn't supported. Instead, update the data volume's block device mapping in the node group's launch template, then replace the nodes. The new nodes come up with new local volumes, which the rule activates.
Uninstalling
Preparing to Uninstall
Deactivating autoscaling creates a new EBS volume with a new ID. Making the volume independent of Datafy requires an ID swap: updating the volume ID referenced by the PersistentVolume to match the new one. Until then, it continues to operate like an autoscaling volume for CSI-level operations, such as rescheduling to another node, with the Datafy proxy translating requests to the new volume.
A PVC binds to a PersistentVolume by name, and that binding can't change once made. So the new volume ID can't be written directly onto the existing PersistentVolume while a pod is using it.
Because the volume can't be replaced while a pod is using it, Datafy waits until the next time its workload restarts — a rolling update, a node drain, or any other event that recreates the pod. When the PersistentVolume is free, Datafy performs the ID swap: it recreates the PersistentVolume under the same name, pointing at the new volume ID, and rebinds it to the same PVC. The PVC itself is never touched, so the workload keeps its identity throughout.
To swap every volume's ID without waiting for workloads to restart on their own, restart them yourself — for example with kubectl rollout restart — after deactivating autoscaling.
After Uninstalling
If any PersistentVolumes remain that need their ID swapped, the Datafy controller and Datafy proxy sidecar containers remain after uninstalling, along with the RBAC roles, admission webhook, and other resources they require to operate. The Datafy agent is removed immediately regardless.
Once the IDs of all PersistentVolumes are swapped (or the PersistentVolumes are deleted), the controller removes itself, the CSI sidecar containers, and any other remaining resources. From that point on, the CSI driver operates exactly as it did before Datafy was installed.
Last updated
Was this helpful?
