所以我在 3 台 RHEL 8 服务器上运行 k3s 集群,我想使用
helm uninstall longhorn -n longhorn-system
从集群中卸载 Longhorn
现在所有 Longhorn pod、pvc 等都被删除,但仍有一个卷处于删除状态! 这里有一些有关音量的附加信息:
Name: pvc-f1df1bf8-96f4-4b28-a14d-2b20809610df
Namespace: longhorn-system
Labels: longhornvolume=pvc-f1df1bf8-96f4-4b28-a14d-2b20809610df
recurring-job-group.longhorn.io/default=enabled
setting.longhorn.io/remove-snapshots-during-filesystem-trim=ignored
setting.longhorn.io/replica-auto-balance=ignored
setting.longhorn.io/snapshot-data-integrity=ignored
Annotations: <none>
API Version: longhorn.io/v1beta2
Kind: Volume
Metadata:
Creation Timestamp: 2023-08-21T07:31:56Z
Deletion Grace Period Seconds: 0
Deletion Timestamp: 2023-08-24T09:32:05Z
Finalizers:
longhorn.io
Generation: 214
Resource Version: 7787140
UID: 6ffb214d-8ed7-4b7b-910e-a2936b764223
Spec:
Standby: false
Access Mode: rwo
Backing Image:
Base Image:
Data Locality: disabled
Data Source:
Disable Frontend: false
Disk Selector:
Encrypted: false
Engine Image: longhornio/longhorn-engine:v1.4.1
From Backup:
Frontend: blockdev
Last Attached By:
Migratable: false
Migration Node ID:
Node ID:
Node Selector:
Number Of Replicas: 3
Recurring Jobs:
Replica Auto Balance: ignored
Restore Volume Recurring Job: ignored
Revision Counter Disabled: false
Size: 4294967296
Snapshot Data Integrity: ignored
Stale Replica Timeout: 30
Unmap Mark Snap Chain Removed: ignored
Status:
Actual Size: 0
Clone Status:
Snapshot:
Source Volume:
State:
Conditions:
Last Probe Time:
Last Transition Time: 2023-08-21T07:31:57Z
Message:
Reason:
Status: False
Type: toomanysnapshots
Last Probe Time:
Last Transition Time: 2023-08-21T07:31:57Z
Message:
Reason:
Status: True
Type: scheduled
Last Probe Time:
Last Transition Time: 2023-08-21T07:31:57Z
Message:
Reason:
Status: False
Type: restore
Current Image: longhornio/longhorn-engine:v1.4.1
Current Node ID:
Expansion Required: false
Frontend Disabled: false
Is Standby: false
Kubernetes Status:
Last PVC Ref At: 2023-08-24T09:32:04Z
Last Pod Ref At: 2023-08-24T09:24:48Z
Namespace: backend
Pv Name:
Pv Status:
Pvc Name: pvc-longhorn-db
Workloads Status:
Pod Name: wb-database-deployment-8685cbdcfc-2dfs2
Pod Status: Failed
Workload Name: wb-database-deployment-8685cbdcfc
Workload Type: ReplicaSet
Last Backup:
Last Backup At:
Last Degraded At:
Owner ID: node3
Pending Node ID:
Remount Requested At: 2023-08-24T09:23:55Z
Restore Initiated: false
Restore Required: false
Robustness: unknown
Share Endpoint:
Share State:
State: deleting
Events: <none>
我尝试删除终结器,但这对我没有帮助。有谁知道为什么该卷无法卸载?
如果您删除了 PVC 并且还使用了终结器命令,则意味着与该 PV 关联的某些资源仍在运行。也许在不同的命名空间中。 首先,再次运行此命令以确保正确应用终结器。
kubectl patch pv <pv_name> -p '{"metadata":{"finalizers":null}}'
and then
kubectl delete pv <pv_name> --grace-period=0 --force
如果PV仍未删除,则使用此命令检查资源。
PVC_NAME="<pvc-name>"; kubectl get pods,deployments,statefulsets,daemonsets,replicasets,jobs,cronjobs --all-namespaces -o json | jq --arg PVC "$PVC_NAME" '.items[] | select(.spec.template.spec.volumes[]?.persistentVolumeClaim.claimName == $PVC) | .metadata.namespace + "/" + .metadata.name + " (" + .kind + ")"'
这将返回该 PV 正在使用的信息,然后手动删除这些资源。一旦删除这些资源,PV 将被删除。我希望这有帮助。