Back to Blog

Supporting emptyDir Volumes in Convox v3 Kubernetes Racks

Introduction

In our continuous effort to enhance Convox's v3 Kubernetes (k8s) Racks, we are excited to introduce support for emptyDir volumes. This feature allows for more flexible management of temporary data within your applications, facilitating high-performance and stateless computation workloads.

What are emptyDir Volumes?

emptyDir volumes are a vital feature in Kubernetes, providing temporary file storage that is tied to the lifecycle of a pod. When a pod is created on a node, Kubernetes creates an associated emptyDir volume, which remains as long as the pod runs on that node. Data in emptyDir volumes is ephemeral and is deleted once the pod is removed or deleted.

Feature Details and Usage

The introduction of emptyDir volumes in Convox v3 Kubernetes racks enables your applications to utilize temporary storage that is fast and node-specific. These volumes do not persist data across pod restarts, making them ideal for temporary workloads and high-speed data processing.

Configuring emptyDir Volumes

To leverage emptyDir volumes in your Convox Kubernetes applications, you can specify them in your convox.yml file as follows:

environment:
 - PORT=3000
services:
 app:
   build: .
   port: 3000
   volumeOptions:
     - emptyDir:
         id: "my-vol1"
         mountPath: "/data"
     - emptyDir:
         id: "my-vol2"
         mountPath: "/data2"
         medium: Memory

Medium Options

The medium attribute in emptyDir volumes allows you to specify the storage medium. Setting this to Memory utilizes RAM, providing faster access speeds beneficial for certain cache or workload scenarios, whereas the default (null) uses the node's local storage.

Best Practices and Use Cases

While emptyDir volumes are versatile, they are best suited for:

  • Temporary workspace for a pod.
  • Storing cache or log files that do not need to persist beyond the life of the pod.
  • Applications that require quick access to scratch space.

Remember, data in emptyDir volumes is not durable and should not be used for critical data that requires persistence.

Version Requirements

To use emptyDir volumes, ensure your rack is updated to version 3.16.0 or later. Although emptyDir itself introduces no breaking changes, it is important to note that the 3.16.0 rack update includes critical Kubernetes version updates.

Updating Your Rack

If you are on a version prior to 3.16.0, you can update your rack using:

convox rack update 3.16.0 -r rackName

It's crucial to verify you're on at least version 3.15.0 before this update. For detailed instructions on updating your rack, refer to the Convox documentation on "Updating a Rack".

Conclusion

The support for emptyDir volumes in Convox's Kubernetes platform underscores our commitment to providing robust and flexible solutions for your containerized applications. By leveraging this feature, you can optimize your applications for performance and efficiency, ensuring that your temporary data management is seamless and effective.

Let your team focus on what matters.