Detach Volumes
Shut down all Kubernetes Pods using Longhorn volumes in order to detach the volumes. The easiest way to achieve this is by deleting all workloads and recreate them later after upgrade. If this is not desirable, some workloads may be suspended.
Each workload can be modified to shut down its pods.
DaemonSet
Edit the daemonset with kubectl edit ds/<name>
.
Add a nodeSelector to the pod spec:
spec:
template:
spec:
nodeSelector:
no-schedule: "true"
Pod
Delete the pod with kubectl delete pod/<name>
.
There is no way to suspend a pod not managed by a workload controller.
CronJob
Edit the cronjob with kubectl edit cronjob/<name>
.
Set .spec.suspend
to true
.
Wait for any currently executing jobs to complete, or terminate them by deleting relevant pods.
Job
Consider allowing the single-run job to complete.
Otherwise, delete the job with kubectl delete job/<name>
.
ReplicationController
Edit the replicationcontroller with kubectl edit rc/<name>
.
Set .spec.replicas
to 0
.
Wait for the volumes using by the Kubernetes to complete detaching.
Then detach all remaining volumes from Longhorn UI. These volumes were most likely created and attached outside of Kubernetes via Longhorn UI or REST API.