problem
Today there is a pv No, after you delete the associated pvc, pv deleted when problems arise on the machine, as follows, delete mysql-wordpress
[root@cbov10-devk8s56-117 mysql]# kubectl get pv|grep mysql mysql-pv-volume 5Gi RWO Retain Bound default/mysql-pv-claim manual 153d mysql-wordpress 5Gi RWX Retain Bound basic-server/mysql-wordpress mysql-wordpress 66m
[root@cbov10-devk8s56-117 mysql]# kubectl delete pv mysql-wordpress persistentvolume "mysql-wordpress" deleted ^C [root@cbov10-devk8s56-117 mysql]# kubectl delete pv mysql-wordpress persistentvolume "mysql-wordpress" deleted ^C
Has been deleted can not afford
solution
[root@cbov10-devk8s56-117 mysql]# kubectl patch pv mysql-wordpress -p '{"metadata":{"finalizers":null}}' persistentvolume/mysql-wordpress patched
[root@cbov10-devk8s56-117 mysql]# kubectl get pv|grep mysql mysql-pv-volume 5Gi RWO Retain Bound default/mysql-pv-claim manual 153d
Think
patch: merge, patch.
Here to "patch" approach (JSON format) to modify a specified field of an object API, which is the most important ability of declarative API kubernetes.
kubernetes shared the great God Zhang Lei, subscribe to his recommendation geek column, write very well.