Longhorn Use Case?

I’m new to Kubernetes and the concept of replicated ha storage like Longhorn intrigues me. However, after days of searching I cannot figure out if Longhorn is the right solution for me instead of my current NFS based solution.

Let’s say I want to host an nginx pod in Kubernetes for a regularly deployed website. How would we deploy the updated data into the storage?

Currently using docker with an nfs volume mount, we have a CI setup in Teamcity/Jenkins that generates all the content from code and once completed it will deploy the artifacts into nfs by copying the files directly into the nfs path. The new pages are immediately available.

How can we achieve similar with kubernetes + longhorn? Or is kubernetes + nfs the better option still for this scenario?

Looking into all the examples and guides on Longhorn so far seems more focused on kubectl exec’ing into the pod and manually modifying data, which doesn’t really demonstrate a real-world scenario.

Hi @CanisHelix

Longhorn provides persistent storage to the Kubernetes pod
In your case, I would suggest

  • Run a NFS server on the Kubernetes and mount the Longhorn Volume to it
  • The NFS server further serve the longhorn volume mount point path
  • Run the Nginx pod and mount the NFS to it

Now you can still follow the original workflow to update the artifacts in the NFS server
And the artifacts are actually stored in the Longhorn volume which make sure your data is persisted and replicated.
More over you can use Longhorn snapshot feature to snapshot the data and restore it back at anytime.

The point here is when running NFS on the Kubernetes, it is a just pod which can be deleted at any time. If you don’t mount the volume to it then the data inside the pod will not be persisted.

Longhorn provide the persistent volume so you can use it to mount to the pod to persist the data.