Help me understand the underlying file system of kurtosis on kubernetes #946
-
I'm curious what the underlying file system is like of kurtosis. In case these files don't live in pvs, as far as I know they are living in /tmp and would not survive a reboot. Also it seems to me that each process is just spun up in a pod, instead of statefulset. This way the process can't be rescheduled into other pods, nor can it be 'retrieved' after its been killed easily. However, this is another question, is outside of the scope of this question. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Hey @barnabasbusa , great question! I'll first give some history, and then explain how it's led us to the current world. When Kurtosis started, we were focused on ephemeral testing environments in CI on Docker. Users would create one enclave per test, run the test, and then throw away the enclave. We also focused very heavily on reproducibility, since we've experienced firsthand the hell of flaky tests. This meant that a single Git commit would have all the resources (including test logic & files) necessary to run the test, and the test itself would be described in the predecessor to Kurtosis Starlark. In this world, persistence wasn't necessary: we'd load all the resources in the exact same way for each test, and throw everything away when the test was done. (this is also why enclaves aren't restartable, as you correctly mentioned in #853 - it wasn't much needed at the time) Kurtosis moves files around through files artifacts, which are basically just TGZs coordinated by the Kurtosis API container running inside the enclave. In Docker, we just write these TGZs to the API container's container filesystem (since the container filesystem persists through restarts). When we added Kubernetes support, it seemed like the analog was to have a Persistent Volume for each APIC. However, we quickly hit limits using DigitalOcean's managed k8s: PVs would take on the order of minutes to create on-demand, and you were limited to 10 of them. We then learned that Kubernetes seems to want a small number of PersistentVolumes, and lots of PersistentVolumeClaims made on top of them, so we switched to the user configuring a single PV for all of Kurtosis, and each APIC making a PVC for a subpath of the PV to store the files artifacts. But Kurtosis was still mostly used for testing usecases, and we realized that the requirement to bring a PV was providing more friction than benefit (the user had to create the PV, and then plug it into the Kurtosis config) so we simply had the APIC write it to its container filesystem. This was simpler, but has exactly the downside you described: those files won't survive a reboot. That was fine in the world where Kurtosis is used for ephemeral test enclaves, but since then Kurtosis usage has started to expand upstream to dev/prototyping (using a Kurtosis enclave to spin up resources in an enclave that will live for a while, and continually iterating against it) and downstream towards prod (spin up an eternal enclave that is receiving constant updates and has durable data). Which basically means that the product needs to advance! We've been anticipating and planning for this, and this is what's going to be happening in the next several months to cope:
Lastly, you mentioned, "how can I explore the Kurtosis filesystem?" If you wanted to go very deep, you could shell into the APIC itself, though we don't recommend doing this because it's basically messing with the internals of Kurtosis. The much cleaner way would be Example of
Example of
Example of inspecting a file inside the files artifact via
If this answered your question, would you mind marking this as the answer? Thanks! |
Beta Was this translation helpful? Give feedback.
-
And created #949 to track your follow-on question! |
Beta Was this translation helpful? Give feedback.
-
Yes, I can confirm, that these are located on a local machine's computer at path
In case of NFS: A PersistentVolume (PV) is an atomic abstraction. You can not subdivide it across multiple claims. A persistent volume claim (PVC) specifies the desired access mode and storage capacity. Currently, based on only these two attributes, a PVC is bound to a single PV. Once a PV is bound to a PVC, that PV is essentially tied to the PVC’s project and cannot be bound to by another PVC. Source In case of a cloud provided PV, seems like some cloud providers do not support
Creating any kubernetes cluster that supports ReadWriteMany might require special file system in the backend, such as Ceph or Longhorn. What kind of cloud offering do you plan to offer? Ethereum (or other blockchain products) require very low latency storage solutions, otherwise they might fall behind the chain, and would end up trying to sync to head indefinitely. My takeaway:As I currently understand everything inside kubernetes right now sort of runs in an EmptyDir ( Volumes:
files-artifact-expansion:
Type: EmptyDir (a temporary directory that shares a pod's lifetime) One could set the emptyDir.medium field to “Memory” to tell Kubernetes to mount a tmpfs (RAM-backed filesystem) for you instead. The location should of emptyDir should be in You can use a pod escalation to get access to the file system of the node (in case you don't already have direct access to the cluster node yourself). For example: Thanks for the explanation, and clarifications. I now have a much better understanding of the kurtosis. |
Beta Was this translation helpful? Give feedback.
-
Thanks; that's good to know! We'd been using DigitalOcean's default PV which I think is analogous to S3 buckets (which can be subdivided).
Yep; most Kubernetes PV drivers don't support ReadWriteMany and it makes sense to me. While it's convenient for dev, the "one writable filesystem mounted in multiple places" pattern means that you're running a high risk of data corruption. We've often received the request, "why don't you let me mount a volume across many containers like Docker does?" Docker can do this because it's all local filesystem disk, but that breaks down in the k8s (and Prod) world for exactly the data corruption issue. To make Kurtosis usable on both Dev and Prod, we're trying to figure out a happy medium that allows for flexible, easy dev workflows while still being safe for Prod.
Thanks; that's a good flag on latency. Do you have a preferred PV driver that you use right now that works?
Basically - all the storage for everything right now is ephemeral, though we're going to be changing this in the next 1-2 months.
Yep definitely an option, though I'm not very inclined to to do this because it requires your Nodes to have tons of memory (which is more expensive). Perhaps an advanced option that we'd allow in the medium/longterm future for extremely performance-intensive applications.
I'd strongly recommend just using
Awesome; glad it helped! I'll also add this to an FAQ on our docs to help folks with similar questions :) |
Beta Was this translation helpful? Give feedback.
Hey @barnabasbusa , great question! I'll first give some history, and then explain how it's led us to the current world.
When Kurtosis started, we were focused on ephemeral testing environments in CI on Docker. Users would create one enclave per test, run the test, and then throw away the enclave. We also focused very heavily on reproducibility, since we've experienced firsthand the hell of flaky tests. This meant that a single Git commit would have all the resources (including test logic & files) necessary to run the test, and the test itself would be described in the predecessor to Kurtosis Starlark. In this world, persistence wasn't necessary: we'd load all the resources in the exact s…