Setting up persistent storage in a Kubernetes cluster can often feel overwhelming. You're not alone if you've found yourself tangled in complex setups and CLI gymnastics. With a plethora of cloud-native storage solutions available, choosing one that fits small to mid-sized clusters without overkill can be a challenge. But what if there was a simpler way? Enter and Rancher.
Longhorn
Longhorn is a lightweight, distributed block storage system crafted specifically for Kubernetes. It allows you to deploy in minutes directly from the Rancher UI—no terminal required. Imagine achieving production-ready storage without even touching the command line.
Longhorn offers several advantages over traditional storage solutions:
Cloud Native: Tailored for Kubernetes, Longhorn operates entirely within your cluster using containers.
Simplicity: It removes the need for an external storage backend, providing full control over your storage lifecycle.
Efficiency: Synchronous replication across nodes, instant volume creation, and recurring backups ensure data reliability and facilitate disaster recovery.
To start, ensure Rancher is running with at least one active Kubernetes cluster. Additionally, for volume attachment, verify that your worker nodes have open-iscsi installed.
Need to attach a new volume to an existing NGINX deployment? Longhorn simplifies the process:
In Rancher, go to the Storage section, then select Persistent Volume Claims.
Create a new PVC using the Longhorn storage class.
Mount the provisioned volume to your NGINX deployment at /usr/share/nginx/html.
Once attached to the pod, Longhorn activates the volume and distributes replicas for high availability.
Common Pitfall: Ensure the persistent volume is not in a detached state before usage. Longhorn typically handles this seamlessly upon attachment, so double-check if issues arise.
You've just learned how to secure your Kubernetes workloads with persistent, highly available storage using Longhorn—all without leaving the Rancher UI. Ready for more tutorials in the Zero to Hero Rancher series? Subscribe and stay tuned!
By streamlining your setup with Rancher and Longhorn, you can concentrate on scaling your applications without the hassle of complex storage solutions.
If you found this guide helpful, don't forget to like and subscribe!
GitHub cut hosted runner prices but planned fees for self-hosted Actions, triggering backlash. The change was paused. Here’s what happened and what to expect.