This repository contains the source code for longhornctl, a CLI (command-line interface) designed to simplify Longhorn manual operations.
- Install and verify prelight requirements.
- Execute one-time Longhorn operations.
- Gain insight into your Longhorn system.
- Diagnose the health of your Longhorn system.
For detailed usage information and examples, please refer to the document run longhornctl --help.
You can obtain longhornctl either through downloading a prebuilt binary or by building it from source.
-
Remove any previous
longhornctlinstallation.rm -rf /usr/local/bin/longhornctl -
Download the command-line tool release suitable for your operating system and machine architecture from the GitHub release page.
curl -L https://github.com/longhorn/cli/releases/download/${LonghornVersion}/longhornctl-${OS}-${ARCH} -o longhornctl chmod +x longhornctl mv ./longhornctl /usr/local/bin/longhornctl -
Verify that you've installed
longhornctl version
- Clone repository
git clone https://github.com/longhorn/cli.git
- Build the
longhornctlbinarycd cli makeNote: This process will generate two binaries:
longhornctl: A command-line interface for remote Longhorn operations, designed to be run outside the Kubernetes cluster. It executeslonghornctl-localfor operations within the cluster.longhornctl-local: A command-line interface to be used within a DaemonSet pod inside the Kubernetes cluster, handling in-cluster and host operations.
The longhornio/longhorn-cli images are signed by the build workflow with Cosign keyless signing: right after an image is pushed, the digest of its multi-arch image index is signed using the GitHub Actions OIDC identity of the workflow, and the signature is stored in the registry and recorded in the Rekor transparency log. Release images and branch builds (master and v* branches, published as <branch>-head) are signed; images published before signing was introduced are not.
Verify an image with cosign v3.1.0 or later. The exact identity ties the signature to the release you expect, so an image signed for another tag is rejected:
cosign verify docker.io/longhornio/longhorn-cli:${LonghornVersion} \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--certificate-identity "https://github.com/longhorn/cli/.github/workflows/build.yml@refs/tags/${LonghornVersion}"For a branch build, use the branch ref in the identity, such as build.yml@refs/heads/master for master-head.
Only the multi-arch image index is signed: verify an image by its tag or index digest, not by the digest of a single-platform manifest.
A mirrored image, such as docker.io/rancher/mirrored-longhornio-longhorn-cli, keeps the same digest. If its signature was not mirrored with it, read the signature from the original repository:
COSIGN_REPOSITORY=docker.io/longhornio/longhorn-cli cosign verify <mirrored-image> ...To mirror an image together with its signature, copy its OCI referrers as well, for example with regctl image copy --referrers.