Prerequisites

Each node in the Kubernetes cluster where Longhorn will be installed must fulfill these requirements.

This script can be used to check the Longhorn environment for potential issues.

The initial settings for Longhorn can be customized by editing the deployment configuration file.

Installing Longhorn

  1. Install Longhorn on any Kubernetes cluster using this command:

    1. kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/master/deploy/longhorn.yaml

    One way to monitor the progress of the installation is to watch pods being created in the longhorn-system namespace:

    1. kubectl get pods \
    2. --namespace longhorn-system \
    3. --watch
  2. Check that the deployment was successful:

    1. $ kubectl -n longhorn-system get pod
    2. NAME READY STATUS RESTARTS AGE
    3. csi-attacher-6fdc77c485-8wlpg 1/1 Running 0 9d
    4. csi-attacher-6fdc77c485-psqlr 1/1 Running 0 9d
    5. csi-attacher-6fdc77c485-wkn69 1/1 Running 0 9d
    6. csi-provisioner-78f7db7d6d-rj9pr 1/1 Running 0 9d
    7. csi-provisioner-78f7db7d6d-sgm6w 1/1 Running 0 9d
    8. csi-provisioner-78f7db7d6d-vnjww 1/1 Running 0 9d
    9. engine-image-ei-6e2b0e32-2p9nk 1/1 Running 0 9d
    10. engine-image-ei-6e2b0e32-s8ggt 1/1 Running 0 9d
    11. engine-image-ei-6e2b0e32-wgkj5 1/1 Running 0 9d
    12. longhorn-csi-plugin-g8r4b 2/2 Running 0 9d
    13. longhorn-csi-plugin-kbxrl 2/2 Running 0 9d
    14. longhorn-csi-plugin-wv6sb 2/2 Running 0 9d
    15. longhorn-driver-deployer-788984b49c-zzk7b 1/1 Running 0 9d
    16. longhorn-manager-nr5rs 1/1 Running 0 9d
    17. longhorn-manager-rd4k5 1/1 Running 0 9d
    18. longhorn-manager-snb9t 1/1 Running 0 9d
    19. longhorn-ui-67b9b6887f-n7x9q 1/1 Running 0 9d
  3. To enable access to the Longhorn UI, you will need to set up an Ingress controller. Authentication to the Longhorn UI is not enabled by default. For information on creating an NGINX Ingress controller with basic authentication, refer to this section.

  4. Access the Longhorn UI using these steps.

List of Deployed Resources

The following items will be deployed to Kubernetes:

Namespace: longhorn-system

All Longhorn bits will be scoped to this namespace.

ServiceAccount: longhorn-service-account

Service account is created in the longhorn-system namespace.

ClusterRole: longhorn-role

This role will have access to:

  • In apiextension.k8s.io (All verbs)
    • customresourcedefinitions
  • In core (All verbs)
    • pods
      • /logs
    • events
    • persistentVolumes
    • persistentVolumeClaims
      • /status
    • nodes
    • proxy/nodes
    • secrets
    • services
    • endpoints
    • configMaps
  • In core
    • namespaces (get, list)
  • In apps (All Verbs)
    • daemonsets
    • statefulSets
    • deployments
  • In batch (All Verbs)
    • jobs
    • cronjobs
  • In storage.k8s.io (All verbs)
    • storageclasses
    • volumeattachments
    • csinodes
    • csidrivers
  • In coordination.k8s.io
    • leases
  • In longhorn.rancher.io (All verbs, deprecated after v0.7.0)
    • volumes
    • engines
    • replicas
    • settings
    • engineimages
    • nodes
    • instancemanagers

ClusterRoleBinding: longhorn-bind

This connects the longhorn-role to the longhorn-service-account in the longhorn-system namespace

CustomResourceDefinitions

The following CustomResourceDefinitions will be installed

  • In longhorn.io
    • engines
    • replicas
    • settings
    • volumes
    • engineimages
    • nodes
    • instancemanagers

Kubernetes API Objects

  • A config map with the default settings
  • The longhorn-manager DaemonSet
  • The longhorn-backend service exposing the longhorn-manager DaemonSet internally to Kubernetes
  • The longhorn-ui Deployment
  • The longhorn-frontend service exposing the longhorn-ui internally to Kubernetes
  • The longhorn-driver-deployer that deploys the CSI driver
  • The longhorn StorageClass