網站首頁 編程語言 正文
以下的 tool
為 Terminating
狀態的 namespace
,下面相關的一些操作記得將 tool
修改成自己的 namespace
名稱
json 格式導出 namespace 信息
k get ns tool -o json > tool.json
修改 json 文件
{ "apiVersion": "v1", "kind": "Namespace", "metadata": { "annotations": { "applicationCnName": "tool", "kubernetes.customized/bocloud_env_id": "3", "kubernetes.customized/bocloud_partition_id": "172", "kubernetes.customized/project_creator": "7", "kubernetes.customized/project_id": "10", "kubernetes.customized/tree_application_id": "10" }, "creationTimestamp": "2022-10-18T06:38:25Z", "deletionTimestamp": "2022-10-20T02:34:18Z", "labels": { "app": "tool" }, "name": "tool", "resourceVersion": "1011030", "selfLink": "/api/v1/namespaces/tool", "uid": "79793f2c-5290-4225-938b-8ce9e639a38c" }, "spec": { "finalizers": [ "kubernetes" ] }, "status": { "conditions": [ { "lastTransitionTime": "2022-10-20T02:34:23Z", "message": "Discovery failed for some groups, 2 failing: unable to retrieve the complete list of server APIs: custom.metrics.k8s.io/v1beta1: the server is currently unable to handle the request, metrics.k8s.io/v1beta1: the server is currently unable to handle the request", "reason": "DiscoveryFailed", "status": "True", "type": "NamespaceDeletionDiscoveryFailure" }, { "lastTransitionTime": "2022-10-20T02:34:23Z", "message": "All legacy kube types successfully parsed", "reason": "ParsedGroupVersions", "status": "False", "type": "NamespaceDeletionGroupVersionParsingFailure" }, { "lastTransitionTime": "2022-10-20T02:34:23Z", "message": "All content successfully deleted, may be waiting on finalization", "reason": "ContentDeleted", "status": "False", "type": "NamespaceDeletionContentFailure" }, { "lastTransitionTime": "2022-10-20T02:34:23Z", "message": "All content successfully removed", "reason": "ContentRemoved", "status": "False", "type": "NamespaceContentRemaining" }, { "lastTransitionTime": "2022-10-20T02:34:23Z", "message": "All content-preserving finalizers finished", "reason": "ContentHasNoFinalizers", "status": "False", "type": "NamespaceFinalizersRemaining" } ], "phase": "Terminating" } }
將 spec 和 status 下面的內容清空,將 metadata 字段花括號結尾的逗號去掉,保留完整的 json 格式
以下是修改過后的樣式 [ 提供參考的,用來和原始 json 做對比,好增加理解 ]
{ "apiVersion": "v1", "kind": "Namespace", "metadata": { "annotations": { "applicationCnName": "tool", "kubernetes.customized/bocloud_env_id": "3", "kubernetes.customized/bocloud_partition_id": "172", "kubernetes.customized/project_creator": "7", "kubernetes.customized/project_id": "10", "kubernetes.customized/tree_application_id": "10" }, "creationTimestamp": "2022-10-18T06:38:25Z", "deletionTimestamp": "2022-10-20T02:34:18Z", "labels": { "app": "tool" }, "name": "tool", "resourceVersion": "1011030", "selfLink": "/api/v1/namespaces/tool", "uid": "79793f2c-5290-4225-938b-8ce9e639a38c" } }
開啟 proxy 服務
這個時候要新打開一個終端,開啟的 proxy 服務不是后臺運行的,會占用一個終端
kubectl proxy
開啟后會返回如下的內容
Starting to serve on 127.0.0.1:8001
調用接口刪除 namespace
在另一個可以操作命令的終端,執行下面的 curl 命令
-
tool.json
- 記得修改成自己的文件名稱 -
tool/finalize
- 里面的 tool 修改成自己的namespace
名稱
curl -k -H "Content-Type: application/json" \ -X PUT --data-binary @tool.json \ http://127.0.0.1:8001/api/v1/namespaces/tool/finalize
通過 kubectl 命令查看 namespace 是否還存在
原文鏈接:https://blog.csdn.net/u010383467/article/details/127487098
相關推薦
- 2023-01-08 react?頁面加載完成后自動執行標簽的點擊事件的兩種操作方法_React
- 2023-05-18 Python使用requirements.txt和pip打包批量安裝的實現_python
- 2022-08-10 pandas.DataFrame.iloc的具體使用詳解_python
- 2023-12-18 Path環境變量點編輯無法展開
- 2023-07-05 cnpm安裝appium出現cannot find module xxx
- 2022-11-29 React?Hooks獲取數據實現方法介紹_React
- 2024-04-04 mybatis-config.xml的配置
- 2022-08-12 Android自定義View實現圓形加載進度條_Android
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支