2025-01-02 10:46:09 +08:00

46 lines
885 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### 1、修改PV的回收策略为Retain
```
#kubectl edit pv PVNAME
persistentVolumeReclaimPolicy: Retain
```
### 2、备份pvc yaml
```
kubectl get pvc PVCNAME -o yaml > PVCNAME.yml
```
### 3、停止相关pod当pod停止后相关pvc会删除
```
# 删除pod
kubectl -n test scale deploy nginx --replicas=0
# 查看pvc
kubectl get pvc
```
### 4、修改pv删除以前的绑定信息
```
kubectl edit pv PVNAME
# 找到如下内容并删除共7行
# claimRef:
# apiVersion: v1
# kind: PersistentVolumeClaim
# name: data-apisix-etcd-1
# namespace: arexpert
# resourceVersion: "15491"
# uid: 050108cd-ba8e-4f2f-9345-dbca90a43c85
```
### 5、删除完成后保存退出重新创建pvc并查看状态启动pod查看状态
```
kubectl apply -f PVCNAME.yml
kubectl get pvc
kubectl -n test scale deploy nginx --replicas=0
```