pv,pvc,namespace 강제 삭제
pv나 pvc삭제시
kubectl delete pv/pv-name or pvc/pvc-name으로 안될때
--grace-period=0 이 옵션을 해보고 안되면 --grace-period=0 --force
이것도 안될경우
edit후
- kubernetes.io/pv-protection
해당 부분이 존재하는지 확인해본다
만약 있다면
kubectl patch pvc pvc_name -p '{"metadata":{"finalizers":null}}'
kubectl patch pv pv_name -p '{"metadata":{"finalizers":null}}'
kubectl patch pod pod_name -p '{"metadata":{"finalizers":null}}'
이렇게 삭제할수 있다
자세한 내용은 아래를 참고하길 바란다
Extend the Kubernetes API with CustomResourceDefinitions
This page shows how to install a custom resource into the Kubernetes API by creating a CustomResourceDefinition. Before you begin You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster.
kubernetes.io
namespace 강제 삭제는 아래와 같이 하십시오. ns환경변수에 지울 namespace명 넣고 실행하면 됩니다.
$ ns=myns
$ kubectl get namespace "${ns}" -o json \
| tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" \
| kubectl replace --raw /api/v1/namespaces/"${ns}"/finalize -f -