1
0
Fork 0
kubernetes/storage
Dustin 6df6e552b7 longhorn: Remove node selector labels
I originally added the `du5t1n.me/storage` label to the x86_64 nodes and
configured Longhorn to only run on nodes with those labels because I
thought that was the correct way to control where volume replicas are
stored.  It turns out that this was incorrect, as it prevented Longhorn
from running on non-matching nodes entirely.  Thus, any machine that was
not so labeled could not access any Longhorn storage volumes.

The correct way to limit where Longhorn stores volume replicas is to
enable the `create-default-disk-labeled-nodes` setting.  With this
setting enabled, Longhorn will run on all nodes, but will not create
"disks" on them unless they have the
`node.longhorn.io/create-default-disk` label set to `true`.  Nodes that
do not have "disks" will not store volume replicas, but will run the
other Longhorn components and can therefore access Longhorn volumes.

Note that changing the "default settings" ConfigMap does not change the
setting once Longhorn has been deployed.  To update the setting on an
existing installation, the setting has to be changed explicitly:

```sh
kubectl get setting -n longhorn-system -o json \
    create-default-disk-labeled-nodes \
    | jq '.value="true"' \
    | kubectl apply -f -
```
2022-10-11 21:58:43 -05:00
..
README.md storage: Show how to create admin password secret 2022-08-23 21:21:43 -05:00
longhorn-ingress.yaml storage: Add manifest for Longhorn 2022-07-31 00:57:53 -05:00
longhorn.yaml longhorn: Remove node selector labels 2022-10-11 21:58:43 -05:00

README.md

Persistent Storage Using Longhorn

Longhorn is a Kubernetes-native persistent storage system. It is quite complex, but installing it is fairly straightforward.

Installation

This is mostly based on the official Install with Kubectl instructions. I wanted to add node selectors to the user-deployed and system-managed components, to ensure that Longhorn only runs on x86_64 nodes, per the Node Selector instructions.

kubectl apply -f longhorn.yaml

Ingress

Expose the Longhorn UI outside the cluster:

printf 'Longhorn username: '
read longhorn_username
printf 'Longhorn password: '
read -s longhorn_password
printf '%s:%s\n' \
    "${longhorn_username}" \
    "$(openssl passwd -stdin -apr1 <<< "${longhorn_password}")" \
    > auth
kubectl create secret generic -n longhorn-system basic-auth --from-file auth
kubectl apply -f longhorn-ingress.yaml