Problem phenomenon:
After kubectl delete ns XXXX, the namespace is always in the terminating state.
Use: kubectl delete ns monitoring — grace period = 0 – force cannot be deleted
Error message:
warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.
Error from server (Conflict): Operation cannot be fulfilled on namespaces ” monitoring “: The system is ensuring all content is removed from this namespace. Upon completion, this namespace will automatically be purged by the system.
Solution:
1. Export namespace information
kubectl get namespace monitoring -o json > monitoring.json
2. Delete the contents under spec in JSON file
The purpose of this step is to clear the content and overwrite the original ns with the ns of the empty content, so as to ensure that the NS content to be deleted is empty and the deletion command cannot be blocked
3. Overlay the empty namespace into the k8s cluster through the API server interface
curl -k -H “Content-Type: application/json” -X PUT –data-binary @monitoring.json http://127.0.0.1:8081/api/v1/namespaces/monitoring/finalize
4. For clusters without authentication, you can perform steps 1-3. For those with authentication, you need to use Kube proxy to proxy:
Open k8s two windows of the master node,
Execute kubectl proxy in one window
Execute in another window: curl – K – H “content type: application/JSON” – x put — data binary @ monitoring.json http://127.0.0.1:8081/api/v1/namespaces/monitoring/finalize
Similar Posts:
- Kubectl’s plug-in management tool Krew
- The newly deployed k8s cluster of the virtual machine reports an error when executing kubectl logs and exec
- [Solved] ElasticSearch Error: FORBIDDEN/12/index read-only/allow delete (api) ,read_only_allow_delete Set windows
- How to Solve Curl pass large JSON files Error
- [Solved] Failed to get node ip address matching nodeport cidr: no addresses found for cidrs [172.16.19.0/24]
- PHP Curl: How to Sending Post JSON Formate Data
- [Solved] kubeadm join 192.168.50.66:6443 –token 0109we.c3a3ofn0y0lmp0w9 –discovery-token-ca-cert-hash sha256:262f5eefdbeba51e6875cba5ed6e34061ad679f8a21f6e295d9fbd5ef05757e4
- java.rmi.RemoteException: VI SDK invoke exception:org.dom4j.DocumentException: Error on line 1 of document : Content is not allowed in prolog. Nested exception: Content is not allowed in prolog.
- failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
- Elasticsearch + kibana set user name and password to log in