Hello everyone, I’m reaching out to check if anyo...
# troubleshooting
h
Hello everyone, I’m reaching out to check if anyone here has experience running Apache Flink with the
flink-kubernetes-operator
on AWS EKS. We’re working with jobs that have significantly large states, ranging from hundreds of GBs to TBs, stored in RocksDB. This requires our TaskManagers to run on instances equipped with dedicated local storage,
i4i
and
r6gd
types. Our challenge comes when mounting these local storage drives into the pods. The
flink-kubernetes-operator
deploys TaskManagers using Deployments, which means we can’t leverage K8s’ local PersistentVolumes as in StatefulSets. Additionally, emptyDir volumes aren’t a viable option for us because EKS mounts them outside the required drive path. To work around this, we are using hostPath volumes. However, this led to another issue: Kubernetes doesn’t seem manage the lifecycle of hostPath volumes. As a result, when TaskManagers are relocated, their previous data doesn’t get automatically cleaned up, eventually filling up the disks. Does anyone know if there is a better way to approach it?
g
Can you simply mount the PV using the podTemplate? What’s the issue there? There are many users/companies running jobs with the Flink operator on eks with very large states
h
Since the TMs are deployed using
Deployments
, wouldn’t that require the volumes to be
ReadWriteMany
? How would that work with Local PVs, where the TMs could be deployed in different nodes, each with their own storages?
g
I think this is a common misconcenption related to the local state vs durable storage. The PV would be used only for local working dir (like ephemeralStorage) , it does not need to be persisted and should be
ReadWriteOnce
. Checkpointing will still copy data to durable storage like S3 / HDFS. This cannot be substituted easily with PVs even if you switch to Statefulsets.
t
First off, your choice of i4i and r6gd instances for their dedicated local storage is spot-on for high-performance stateful workloads. But, as you’ve noticed, the marriage between Kubernetes’ ephemeral storage approach and stateful, large-scale data processing needs can be a bit rocky. The flink-kubernetes-operator is a fantastic tool for managing Flink on Kubernetes, but its default use of Deployments over StatefulSets can indeed complicate things when dealing with local storage. Your pivot to hostPath volumes is a clever workaround, though the lack of automatic lifecycle management is a thorny issue.
Here’s a couple of thoughts that might help: a. Init Containers: You could use an init container in your TaskManager pods to clean up the hostPath directory at startup. This would ensure that any residual data from previous instances is cleared before a new TaskManager starts. It’s a bit of manual handling but can be effective. b. Advanced Volume Controllers: Consider exploring more advanced Kubernetes storage solutions like Rook or Portworx. These can offer more sophisticated volume management that might better suit your needs, including automatic cleanup, replication, and even data mobility across nodes. c. StatefulSets with PersistentVolumeClaims: While the flink-kubernetes-operator defaults to Deployments, it might be worth exploring if you can extend or customize it to use StatefulSets for TaskManagers, especially for such state-intensive workloads. This could potentially allow you to leverage dynamic provisioning of local PersistentVolumes using something like the Local Persistent Volume static provisioner, which is designed for such use cases. d. Manual Cleanup Jobs: As a last resort, you could schedule periodic Kubernetes jobs that clean up unused hostPath volumes. This would require some manual setup to track and target the directories for cleanup, but it’s a feasible stopgap. e. Feedback Loop: Given the complexity and the specific requirements of your workload, contributing back to the flink-kubernetes-operator community with this use case might also spark new features or best practices tailored to high-state scenarios like yours. Each of these options comes with its own set of considerations, so it might be worth experimenting to see which one aligns best with your operational constraints and performance requirements. Navigating Kubernetes’ storage paradigms for stateful applications like Flink is no small feat, but with some ingenuity and maybe a bit of custom engineering, you should find a path that works for you. Keep pushing the boundaries, and don’t hesitate to share your progress or further challenges!
h
In our case the checkpoints and savepoints are written directly to S3 and are not a problem. The issue lies in the RocksDB
localDir
. What I’m looking for is alternatives to using the
hostPath
volume on TaskManagers as it doesn’t seem to be the best approach.
emptyDir
does not seem work in EKS because it gets mounted out of the NVME drive and there is no option to change it.
Using the
hostPath
approach, when a TaskManager gets reallocated (for any reason), the state that it used is not cleaned and is left behind. Eventually the disks get filled and the quick solution is to delete the entire instance. We could try to solve it by using K8s sync hooks and delete the files, but I’m not how safe it is to delete the state files without any sort of synchronization garantee
g
What about the
ReadWriteOnce
PV? You woulndt need to clean it up then?
h
Yes, but it is more explicit than using
hostPath
, where K8s has no information on the volume and no way to relate storage to pods (PVC).
But I’m not sure what is the best approach here, just wanted to check in with the community
a
@Hygor Knust Did you get something? I have decided to edit the flink src code to create PVC when the task manager pods are created. How are you doing it?