Content from official sourcesLonghorn 1.1.2
Technical manual in English.
A series of
- What’s a Longhorn?
- Longhorn Cloud Native Container Distributed Storage – Design architecture and concepts
- Longhorn Cloud Native Container Distributed Storage – Deployment chapter
- Longhorn Cloud Native Container distributed storage – coupons and nodes
- Longhorn Cloud Native Container Distributed Storage – K8S resource configuration example
- Longhorn Cloud Native Container Distributed Storage – Monitoring (Prometheus)
- Longhorn Cloud Native Container Distributed storage – backup and restore
- Longhorn Cloud Native Container distributed storage – high availability
- Longhorn Cloud Native Container distributed storage – Supports ReadWriteMany (RWX) workloads
- Longhorn Cloud Native Container Distributed Storage – Custom deployment defaults
Longhorn can be installed in Air Gapped using the Manifest file, Helm Chart, or Rancher UI.
directory
- A requirement
- use
Manifest File
- use
Helm chart
- use
Rancher app
- troubleshooting
A requirement
- will
Longhorn Components
Deploy the image to your ownregistry
. - will
Kubernetes CSI driver
Deploy the component image to your ownregistry
.
Note:
-
A complete list of all required images is in longhorn-images.txt. First, run the download image list:
Wget HTTP: / / https://raw.githubusercontent.com/longhorn/longhorn/v1.1.2/deploy/longhorn-images.txtCopy the code
-
We provide a script save-images.sh to quickly pull the longhorn-images.txt list above. If you specify the tar.gz file name for the flag –images, the script saves all images to the provided file name. In the example below, the script pulls and saves the Longhorn image to the file longhorn-images.tar.gz. You can then copy this file into your AIR-Gap environment. On the other hand, if you don’t specify a file name, the script will just pull the list of images onto your computer.
Wget https://raw.githubusercontent.com/longhorn/longhorn/v1.1.2/scripts/save-images.sh chmod + x save - images. Sh ./save-images.sh --image-list longhorn-images.txt --images longhorn-images.tar.gzCopy the code
-
We provide another script, load-images.sh, to push the Longhorn image to your private Registry. If you specify the tar.gz file name for the flag –images, the script loads the images from the tar file and pushes them. Otherwise, it will find the images in your local Docker and push them. In the following example, the script loads images from the file longhorn-images.tar.gz and pushes them to < your-private-registry >
Wget https://raw.githubusercontent.com/longhorn/longhorn/v1.1.2/scripts/load-images.sh chmod + x the load - images. Sh ./load-images.sh --image-list longhorn-images.txt --images longhorn-images.tar.gz --registry <YOUR-PRIVATE-REGISTRY>Copy the code
-
For more options for using scripts, see Flag –help:
./save-images.sh --help ./load-images.sh --help Copy the code
Use the Manifest File
-
Get the Longhorn Deployment manifest file
Wget HTTP: / / https://raw.githubusercontent.com/longhorn/longhorn/v1.1.2/deploy/longhorn.yaml
-
Create a Longhorn namespace
kubectl create namespace longhorn-system
-
If the private Registry requires authentication, create docker-Registry secret in the Longhorn-system namespace:
kubectl -n longhorn-system create secret docker-registry <SECRET_NAME> --docker-server=<REGISTRY_URL> --docker-username=<REGISTRY_USER> --docker-password=<REGISTRY_PASSWORD>
-
Add your secret name SECRET_NAME to imagepullsecrets.name in the following resource
longhorn-driver-deployer
Deploymentlonghorn-manager
DaemonSetlonghorn-ui
Deployment
Example:
apiVersion: apps/v1 kind: Deployment metadata: labels: app: longhorn-ui name: longhorn-ui namespace: longhorn-system spec: replicas: 1 selector: matchLabels: app: longhorn-ui template: metadata: labels: app: longhorn-ui spec: containers: - name: longhorn-ui image: Longhornio/longhorn - UI: v0.8.0 ports: - containerPort: 8000 env: - name: LONGHORN_MANAGER_IP value: "http://longhorn-backend:9500" imagePullSecrets: - name: <SECRET_NAME> ## Add SECRET_NAME here serviceAccountName: longhorn-service-account Copy the code
-
-
Apply the following changes to the manifest file
-
Modify the Kubernetes CSI Driver component environment variables in Longhorn-driver-Deployer Deployment to point to your private Registry image
- CSI_ATTACHER_IMAGE
- CSI_PROVISIONER_IMAGE
- CSI_NODE_DRIVER_REGISTRAR_IMAGE
- CSI_RESIZER_IMAGE
- CSI_SNAPSHOTTER_IMAGE
- name: CSI_ATTACHER_IMAGE value: <REGISTRY_URL>/csi-attacher:<CSI_ATTACHER_IMAGE_TAG> - name: CSI_PROVISIONER_IMAGE value: <REGISTRY_URL>/csi-provisioner:<CSI_PROVISIONER_IMAGE_TAG> - name: CSI_NODE_DRIVER_REGISTRAR_IMAGE value: <REGISTRY_URL>/csi-node-driver-registrar:<CSI_NODE_DRIVER_REGISTRAR_IMAGE_TAG> - name: CSI_RESIZER_IMAGE value: <REGISTRY_URL>/csi-resizer:<CSI_RESIZER_IMAGE_TAG> - name: CSI_SNAPSHOTTER_IMAGE value: <REGISTRY_URL>/csi-snapshotter:<CSI_SNAPSHOTTER_IMAGE_TAG> Copy the code
-
Modify the Longhorn image to point to your private Registry image
-
longhornio/longhorn-manager
image: <REGISTRY_URL>/longhorn-manager:<LONGHORN_MANAGER_IMAGE_TAG>
-
longhornio/longhorn-engine
image: <REGISTRY_URL>/longhorn-engine:<LONGHORN_ENGINE_IMAGE_TAG>
-
longhornio/longhorn-instance-manager
image: <REGISTRY_URL>/longhorn-instance-manager:<LONGHORN_INSTANCE_MANAGER_IMAGE_TAG>
-
longhornio/longhorn-share-manager
image: <REGISTRY_URL>/longhorn-share-manager:<LONGHORN_SHARE_MANAGER_IMAGE_TAG>
-
longhornio/longhorn-ui
image: <REGISTRY_URL>/longhorn-ui:<LONGHORN_UI_IMAGE_TAG>
Example:
apiVersion: apps/v1 kind: Deployment metadata: labels: app: longhorn-ui name: longhorn-ui namespace: longhorn-system spec: replicas: 1 selector: matchLabels: app: longhorn-ui template: metadata: labels: app: longhorn-ui spec: containers: - name: longhorn-ui image: <REGISTRY_URL>/longhorn-ui:<LONGHORN_UI_IMAGE_TAG> ## Add image name and tag here ports: - containerPort: 8000 env: - name: LONGHORN_MANAGER_IP value: "http://longhorn-backend:9500" imagePullSecrets: - name: <SECRET_NAME> serviceAccountName: longhorn-service-account Copy the code
-
-
-
Deploy Longhorn using the modified manifest file
kubectl apply -f longhorn.yaml
Use the Helm Chart
In V1.1.2, Longhorn automatically prefixes the image with
. You simply set the registryUrl parameter to extract the image from your private Registry.
Note: Once you have set registryUrl to your private Registry, Longhorn will try to extract the image specifically from the registry. Ensure that all Longhorn component images are in the registry, otherwise Longhorn will not be able to pull images.
Use the default image name
If you keep the image name as recommended here, simply perform the following steps:
-
Longhorn Warehouse:
git clone https://github.com/longhorn/longhorn.git
-
In the chart/values. Yaml
- The specified
Private registry URL
. Specify if the registry requires authenticationPrivate registry user
,Private registry password
和Private registry secret
.
Longhorn will use this information to automatically generate a Secret and use it to extract the image from your private Registry.
defaultSettings: registrySecret: <SECRET_NAME> privateRegistry: registryUrl: <REGISTRY_URL> registryUser: <REGISTRY_USER> registryPasswd: <REGISTRY_PASSWORD> registrySecret: <REGISTRY_SECRET_NAME> Copy the code
- The specified
Use a custom image name
If you want to use custom image names, you can use the following steps:
-
Cloning longhorn repo
git clone https://github.com/longhorn/longhorn.git
-
In the chart/values. Yaml
Note: The private Registry prefix is not included, which will be added automatically. For example: if your image is example.com/username/longhorn-manager, please use in the following charts username/longhorn – manager.
-
Specify Longhorn image and tag:
image: longhorn: engine: repository: longhornio/longhorn-engine tag: <LONGHORN_ENGINE_IMAGE_TAG> manager: repository: longhornio/longhorn-manager tag: <LONGHORN_MANAGER_IMAGE_TAG> ui: repository: longhornio/longhorn-ui tag: <LONGHORN_UI_IMAGE_TAG> instanceManager: repository: longhornio/longhorn-instance-manager tag: <LONGHORN_INSTANCE_MANAGER_IMAGE_TAG> shareManager: repository: longhornio/longhorn-share-manager tag: <LONGHORN_SHARE_MANAGER_IMAGE_TAG> Copy the code
-
Specify CSI Driver component images and tags:
csi: attacher: repository: longhornio/csi-attacher tag: <CSI_ATTACHER_IMAGE_TAG> provisioner: repository: longhornio/csi-provisioner tag: <CSI_PROVISIONER_IMAGE_TAG> nodeDriverRegistrar: repository: longhornio/csi-node-driver-registrar tag: <CSI_NODE_DRIVER_REGISTRAR_IMAGE_TAG> resizer: repository: longhornio/csi-resizer tag: <CSI_RESIZER_IMAGE_TAG> snapshotter: repository: longhornio/csi-snapshotter tag: <CSI_SNAPSHOTTER_IMAGE_TAG> Copy the code
-
Specify the Private Registry URL. If Registry requires authentication, specify Private Registry User, Private Registry Password, and Private Registry Secret. Longhorn will use this information to automatically generate a Secret and use it to extract the image from your private Registry.
defaultSettings: registrySecret: <SECRET_NAME> privateRegistry: registryUrl: <REGISTRY_URL> registryUser: <REGISTRY_USER> registryPasswd: <REGISTRY_PASSWORD> Copy the code
-
-
Install the Longhorn
-
Helm2
helm install ./chart --name longhorn --namespace longhorn-system
-
Helm3
kubectl create namespace longhorn-system
helm install longhorn ./chart --namespace longhorn-system
-
Use the Rancher app
Use the default image name
If you keep the image name as recommended above, simply perform the following steps:
-
Specify in the Private Registry Settings section:
- private
registry URL
- private
registry user
- private
registry password
- private
registry secret name
Longhorn will use this information to automatically generate a Secret and use it to extract the image from your private Registry.
- private
Use a custom image name
-
To Use the name of a custom image, set Use Default Images to False and specify the name of the image.
Note: The private Registry prefix is not included, which will be added automatically. For example: if your image is example.com/username/longhorn-manager, please use in the following charts username/longhorn – manager.
-
Specify the Private Registry URL. If the registry requires authentication, specify Private Registry User, Private Registry Password, and Private Registry Secret Name. Longhorn will use this information to automatically generate a Secret and use it to extract the image from your private Registry.
troubleshooting
For Helm/Rancher installations, if the user forgets to commitsecret
To the privateregistry
For authentication, thenlonghorn-manager DaemonSet
Cannot be created.
-
Create Kubernetes secret
kubectl -n longhorn-system create secret docker-registry <SECRET_NAME> --docker-server=<REGISTRY_URL> --docker-username=<REGISTRY_USER> --docker-password=<REGISTRY_PASSWORD>
-
Manually create registry-secret setting objects.
apiVersion: longhorn.io/v1beta1 kind: Setting metadata: name: registry-secret namespace: longhorn-system value: <SECRET_NAME> Copy the code
kubectl apply -f registry-secret.yml
-
Remove Longhorn and reinstall.
-
Helm2
helm uninstall ./chart --name longhorn --namespace longhorn-system
helm install ./chart --name longhorn --namespace longhorn-system
-
Helm3
helm uninstall longhorn ./chart --namespace longhorn-system
helm install longhorn ./chart --namespace longhorn-system
-
Recommendation:
It is strongly recommended not to manipulate mirrored tags, especially instance manager mirrored tags such as v1_20200301, because we deliberately used dates to avoid associating them with the Longhorn version.
The image of the Longhorn component is hosted under the Longhornio account in Dockerhub. For example, Longhornio/Longhorn-Manager :v1.1.2. It is recommended that the account name longhornio be the same when pushing the image to private Registry. This helps avoid unnecessary configuration problems.