Update uninstallation procedure, synchronize chart doc

This commit is contained in:
James Oliver 2019-01-11 12:08:02 -07:00 committed by Sheng Yang
parent 7c52609cc1
commit 6454bd3fa8
3 changed files with 52 additions and 28 deletions

View File

@ -260,24 +260,29 @@ See [here](./docs/troubleshooting.md) for the troubleshooting guide.
## Uninstall Longhorn ## Uninstall Longhorn
Longhorn stores its data in the Kubernetes API server, in the format of CRD. Longhorn CRDs have finalizers; user should delete the volumes and related resource first to give the managers a chance to clean up. 1. To prevent damage to the Kubernetes cluster, we recommend deleting all Kubernetes workloads using Longhorn volumes (PersistentVolume, PersistentVolumeClaim, StorageClass, Deployment, StatefulSet, DaemonSet, etc).
Before uninstalling Longhorn, the user need to delete all the PVC and PV resources which refer to a Longhorn volume in Kubernetes. Otherwise, Kubernetes may get confused because the underlying storage is gone but the PV/PVC remains. 2. Create the uninstallation job to cleanly purge CRDs from the system and wait for success:
```
### 1. Run cleanup script kubectl create -f https://raw.githubusercontent.com/rancher/longhorn/master/deploy/uninstall.yaml
Note that you will lose all volume data after done this. If you intend on keeping any volume data, make backups (and test restoring a volume) before proceeding. kubectl -n longhorn-system get job/longhorn-uninstall -w
```
Example output:
``` ```
curl -sSfL https://raw.githubusercontent.com/rancher/longhorn-manager/master/deploy/scripts/cleanup.sh | bash $ kubectl create -f https://raw.githubusercontent.com/rancher/longhorn/master/deploy/uninstall.yaml
job.batch/longhorn-uninstall created
$ kubectl -n longhorn-system get job/longhorn-uninstall -w
NAME DESIRED SUCCESSFUL AGE
longhorn-uninstall 1 0 3s
longhorn-uninstall 1 1 45s
^C
``` ```
### 2. Delete remaining components 3. Remove remaining components:
```
The cleanup script removes most components, but leaves RBAC related resources and the `longhorn-system` Namespace behind. Run this command to remove these resources. kubectl delete -f https://raw.githubusercontent.com/rancher/longhorn/master/deploy/longhorn.yaml
```
```
kubectl delete -f https://raw.githubusercontent.com/rancher/longhorn/master/deploy/longhorn.yaml
```
## License ## License

27
deploy/uninstall.yaml Normal file
View File

@ -0,0 +1,27 @@
apiVersion: batch/v1
kind: Job
metadata:
name: longhorn-uninstall
namespace: longhorn-system
spec:
activeDeadlineSeconds: 900
backoffLimit: 1
template:
metadata:
name: longhorn-uninstall
spec:
containers:
- name: longhorn-uninstall
image: rancher/longhorn-manager:v0.3.2
imagePullPolicy: Always
command:
- longhorn-manager
- uninstall
- --force
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
restartPolicy: OnFailure
serviceAccountName: longhorn-service-account

View File

@ -2,8 +2,6 @@
The following document pertains to running Longhorn from the Rancher 2.0 chart. The following document pertains to running Longhorn from the Rancher 2.0 chart.
Noted it's recommended to install Longhorn app in a separate Rancher Project, e.g. `Storage` or `Longhorn`.
## Source Code ## Source Code
Longhorn is 100% open source software. Project source code is spread across a number of repos: Longhorn is 100% open source software. Project source code is spread across a number of repos:
@ -14,23 +12,17 @@ Longhorn is 100% open source software. Project source code is spread across a nu
## Prerequisites ## Prerequisites
1. Docker v1.13+ 1. Rancher v2.1+
2. Kubernetes v1.8+ cluster with 1 or more nodes and Mount Propagation feature enabled. If your Kubernetes cluster was provisioned by Rancher v2.0.7+ or later, MountPropagation feature is enabled by default. [Check your Kubernetes environment now](https://github.com/rancher/longhorn#environment-check-script). If MountPropagation is disabled, the Kubernetes Flexvolume driver will be deployed instead of the default CSI driver. Base Image feature will also be disabled if MountPropagation is disabled. 2. Docker v1.13+
3. Make sure `curl`, `findmnt`, `grep`, `awk` and `blkid` has been installed in all nodes of the Kubernetes cluster. 3. Kubernetes v1.8+ cluster with 1 or more nodes and Mount Propagation feature enabled. If your Kubernetes cluster was provisioned by Rancher v2.0.7+ or later, MountPropagation feature is enabled by default. [Check your Kubernetes environment now](https://github.com/rancher/longhorn#environment-check-script). If MountPropagation is disabled, the Kubernetes Flexvolume driver will be deployed instead of the default CSI driver. Base Image feature will also be disabled if MountPropagation is disabled.
4. Make sure `open-iscsi` has been installed in all nodes of the Kubernetes cluster. For GKE, recommended Ubuntu as guest OS image since it contains `open-iscsi` already. 4. Make sure `curl`, `findmnt`, `grep`, `awk` and `blkid` has been installed in all nodes of the Kubernetes cluster.
5. Make sure `open-iscsi` has been installed in all nodes of the Kubernetes cluster. For GKE, recommended Ubuntu as guest OS image since it contains `open-iscsi` already.
## Uninstallation ## Uninstallation
**Do not attempt to immediately delete Longhorn App from Rancher UI. Longhorn propagates device mounts which can damage the host if not unmounted properly.** Follow this procedure instead.
1. To prevent damage to the Kubernetes cluster, we recommend deleting all Kubernetes workloads using Longhorn volumes (PersistentVolume, PersistentVolumeClaim, StorageClass, Deployment, StatefulSet, DaemonSet, etc). 1. To prevent damage to the Kubernetes cluster, we recommend deleting all Kubernetes workloads using Longhorn volumes (PersistentVolume, PersistentVolumeClaim, StorageClass, Deployment, StatefulSet, DaemonSet, etc).
2. [Rancher v2.0.x users only] From the `Cluster` tab, click `Launch kubectl` and run this command: 2. From Rancher UI, navigate to `Catalog Apps` tab and delete Longhorn app.
```
curl -sSfL https://raw.githubusercontent.com/rancher/longhorn-manager/master/deploy/scripts/cleanup.sh | bash
```
3. From Rancher UI, navigate to `Catalog Apps` tab and delete Longhorn app.
## Troubleshooting ## Troubleshooting
@ -59,7 +51,7 @@ By default, Kubernetes uses `/usr/libexec/kubernetes/kubelet-plugins/volume/exec
Some vendors choose to change the directory for various reasons. For example, GKE uses `/home/kubernetes/flexvolume` instead. Some vendors choose to change the directory for various reasons. For example, GKE uses `/home/kubernetes/flexvolume` instead.
If you don't know what the correct directory is for your cluster, please leave the Chart question blank. User can find the correct directory by running `ps aux|grep kubelet` on the host and check the `--volume-plugin-dir` parameter. If there is none, the default `/usr/libexec/kubernetes/kubelet-plugins/volume/exec/` will be used.
--- ---
Please see [link](https://github.com/rancher/longhorn) for more information. Please see [link](https://github.com/rancher/longhorn) for more information.