Longhorn Storage Containers

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up longhorn storage containers by installing the storage manager on your Kubernetes nodes. The system then creates small controller and replica pods for each persistent volume. Most teams install the tool across all worker nodes with default cluster admin roles. When those roles stay too broad, any user or pod can read or delete volumes. How longhorn storage containers work in Kubernetes Kubernetes pods lose their local files whenever they restart or move to another node. Longhorn fix

Rootless Containers: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You set up longhorn storage containers by installing the storage manager on your Kubernetes nodes. The system then creates small controller and replica pods for each persistent volume. Most teams install the tool across all worker nodes with default cluster admin roles. When those roles stay too broad, any user or pod can read or delete volumes.

How longhorn storage containers work in Kubernetes

Kubernetes pods lose their local files whenever they restart or move to another node. Longhorn fixes this problem by turning local node disks into shared block storage. It runs as a set of manager pods, engine pods, and replica pods.

When a user asks for a new volume, the storage driver talks to Kubernetes. The manager pod sees this request and creates one engine container for that volume. It also starts multiple replica containers across different worker nodes to store data copies.

Each replica writes data blocks to the host disk on its own node. The engine container sits in the middle and sends writes to all replicas. If one node fails, the engine reads data from a healthy replica on another node.

This design keeps storage fast and simple because each volume has its own small engine. A failure in one volume engine will not crash storage for other running apps. Teams can also take snapshots and send volume backups to external object stores.

Managing roles and permissions for volume engines

Installing longhorn storage containers requires high privileges on your Linux nodes and Kubernetes API. The system pods must mount host disks and create block devices on every worker node. You set up service accounts and role bindings so the manager can watch cluster resources.

Teams also expose a web dashboard to view disk health, replicas, and backup states. By default, this dashboard does not check who opens it inside the cluster network. You must place an ingress controller with login checks in front of the user interface.

Rootless Containers: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Inside the cluster, you use role-based rules to limit who can claim or delete volumes. A developer role should only create volume claims inside a single team namespace. Cluster admin roles should stay restricted to a few platform engineers who manage node disks.

What native storage roles solve and what they miss

Native Kubernetes roles do a good job of controlling who can create volume claims. They also stop standard users from deleting storage classes or changing backup target settings. These rules check identity at the moment a user connects to the cluster API.

Still, static roles leave a big gap during daily maintenance and live debugging work. Once an engineer logs in with an admin role, every storage command is wide open. Native roles decide who gets in, not what individual commands do in flight.

An engineer fixing a stuck volume can run a shell inside a manager pod. From there, they can read raw volume blocks or wipe replica folders by mistake. Standard role bindings cannot pause a dangerous delete command or ask a peer for approval.

Also, shared admin roles make it hard to track who ran a specific fix. And if someone mounts a database volume to check a bug, raw data flows out. Emails, phone numbers, and card numbers sit right on those mounted storage volumes.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

How many nodes do you need to run Longhorn replicas safely?

You need at least three worker nodes to spread default volume replicas across distinct disks. This setup keeps your volumes online even if one full node goes down.

Do Longhorn engines slow down database reads and writes?

Each volume gets its own dedicated engine pod, so other noisy volumes do not block it. Network speed and fast local solid-state drives matter most for keeping write latency low.

How do you secure the Longhorn dashboard for a team?

Do not expose the dashboard service on a public IP without a login check. Route traffic through an ingress rule that verifies user identity before loading the page.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.