问题:
在k8s里面创建了pv,pvc删除时报错:error: resource(s) were provided, but no name was specified
解决:
正确的删除顺序:1.先删除pod2.再删除pv 3.在删除pvc
删除pv,pvc命令:
kubectl patch pv pvname -p '{"metadata":{"finalizers":null}}'kubectl patch pvc pvcname -p '{"metadata":{"finalizers":null}}'
1.停掉pod
[root@master1 pv]# kubectl delete -f nginx-pod.yaml
service "nginx-service" deleted
deployment.apps "nginx-web" deleted2.解除pv绑定
[root@master1 pv]# kubectl patch pv pv -p '{"metadata":{"finalizers":null}}'
persistentvolume/pv patched3.解除pvc绑定
[root@master1 pv]# kubectl patch pvc pvc -p '{"metadata":{"finalizers":null}}'
persistentvolumeclaim/pvc patched4.删除pv,pvc
[root@master1 pv]# kubectl delete pv pv
persistentvolumeclaim "pv" deleted[root@master1 pv]# kubectl delete pvc pvc
persistentvolumeclaim "pvc" deleted