This plugin integrates Longhorn, a cloud-native distributed block storage system for Kubernetes, into the Headlamp UI. It provides visibility into your Longhorn storage resources directly within Headlamp.
Longhorn provides persistent storage for Kubernetes workloads, but managing and monitoring its components (Volumes, Nodes, Backups, etc.) often requires using the separate Longhorn UI or kubectl. This Headlamp plugin aims to bring essential Longhorn resource details and status directly into your primary Kubernetes dashboard, streamlining storage management workflows.
This plugin currently supports viewing the following Longhorn resources:
- Volumes: List view and detailed view showing status, configuration, Kubernetes PV/PVC links, and conditions.
- Nodes: List view and detailed view displaying status (Ready, Schedulable), configuration, attached disk details (including status and specs in a table), and conditions.
- Settings: A grouped view (categorized based on Longhorn documentation) displaying current setting values and their applied status.
- Backups: List view and detailed view showing state, snapshot info, target, size, timestamps, labels, and error messages.
- Engine Images: List view and detailed view displaying state, image reference, version details, node deployment status, and conditions.
- Headlamp: You need a running instance of Headlamp (either the desktop app or deployed in-cluster).
- Longhorn: Longhorn must be installed and running in the Kubernetes cluster that Headlamp is connected to.
- Navigate to the "Plugins" section in Headlamp.
- Find the "Longhorn" plugin in the catalog. (Note: This assumes the plugin is published to a catalog Headlamp uses).
- Click "Install".
- Reload Headlamp when prompted.
- Build the plugin to get the
main.jsfile (and potentially other assets in thedistdirectory). - Create the plugin directory structure:
- Linux:
~/.config/Headlamp/plugins/headlamp-longhorn/ - macOS:
~/Library/Application Support/Headlamp/plugins/headlamp-longhorn/ - Windows:
%APPDATA%\Headlamp\config\plugins\headlamp-longhorn\
- Linux:
- Copy the contents of the plugin's
distfolder (includingmain.js) and thepackage.jsonfile into theheadlamp-longhorndirectory created above. - Restart Headlamp.
To use this plugin in an in-cluster Headlamp deployment (when using the official Headlamp image), you need an initContainer to copy the plugin files into a shared volume mounted by the main Headlamp container.
If you followed the steps in "Advanced: Building a Plugin-Files Image" below, you can use your built image. Modify your Headlamp Helm values.yaml or Deployment manifest:
# Example using Helm values.yaml
# Add this under the main 'headlamp' deployment configuration
initContainers:
- name: init-longhorn-plugin # Changed name slightly
# Use the image containing your built plugin files
# Ensure this image name matches the one you built/is built by CI
image: gsoci.azurecr.io/giantswarm/headlamp-longhorn:0.1.0 # use the latest release tag
imagePullPolicy: Always
command:
- /bin/sh
- -c
- |
echo "Copying Longhorn plugin..."
# The target directory name MUST match how Headlamp expects to find the plugin
PLUGIN_TARGET_DIR="/headlamp/plugins/headlamp-longhorn"
mkdir -p "$PLUGIN_TARGET_DIR"
# Adjust source path inside the plugin image if necessary (should be /plugins/headlamp-longhorn based on Dockerfile)
cp -r /plugins/headlamp-longhorn/* "$PLUGIN_TARGET_DIR/"
echo "Longhorn plugin copied."
volumeMounts:
- name: plugins # Must match the volume name used by the main Headlamp container
mountPath: /headlamp/plugins
# Ensure the corresponding volumeMount is also present in the main Headlamp container
# spec:
# template:
# spec:
# containers:
# - name: headlamp
# image: ghcr.io/headlamp-k8s/headlamp:latest # Official Headlamp image
# volumeMounts:
# - name: plugins
# mountPath: /headlamp/plugins
# # ... other headlamp container config ...
# volumes:
# - name: plugins
# emptyDir: {}Once installed and Headlamp is connected to a cluster with Longhorn running:
- Look for the Longhorn entry in the main sidebar menu on the left.
- Click on it to expand the sub-menu containing Volumes, Nodes, Settings, Backups, and Engine Images.
- Navigate through the different list and detail views.
Instead of installing the plugin manually, you can build a container image that contains just the necessary files for this plugin (dist/ directory and package.json). This image can then be used with an initContainer (as shown in the In-Cluster Deployment section) to copy the plugin into your main Headlamp deployment.
-
Build the plugin bundle: the repository
Dockerfileonly copies a prebuiltdist/, so build it first:npm run ci:build
-
Build the image: Run this command from the root of the
headlamp-longhornplugin directory:# Build the image containing only the plugin files docker build -t ghcr.io/giantswarm/headlamp-longhorn:my-tag .
(Replace
my-tagwith your desired image tag, e.g.,latestor a version number). -
Push the image: (If needed for your cluster)
# Push the image containing only the plugin files docker push ghcr.io/giantswarm/headlamp-longhorn:my-tag
This image can now be referenced in an initContainer as shown in the In-Cluster Deployment section.
Note: An image containing just the plugin files is automatically built and pushed to gsoci.azurecr.io/giantswarm/headlamp-longhorn by the CircleCI pipeline on every release tag.
To run this plugin locally during development:
- Clone the repository.
- Navigate to the plugin directory (
cd headlamp-longhorn). - Install dependencies:
npm install - Start the development server:
npm run start - Ensure Headlamp (desktop app recommended for development) is running and configured to load plugins from the appropriate directory or that you manually copy the built files to its plugin directory.
Encountered a bug or have a feature request? Please file an issue on the GitHub repository.