下面的工具是终止状态的命名空间。对于下面的一些相关操作,请记住将工具修改为您自己的命名空间名称。
Json格式导出命名空间信息k get nstool-o JSON >: tool.json
修改json文件{"API Version": "v1 "," kind": "namespace "," metadata ":{ " application cnname ":" tool "," kubernetes . customized/bo cloud _ env _ id ":" 3 "," kubernetes . customized/bo cloud _ partition _ id ":" 172 "," kubernetes . customized/project _ creator ":" 7 "," kubernetes . customized/project _ id ":" 10 "," kubernetes . customized/tree _ application _ id ":" 10 " }," creationTimestamp 2失败:无法检索服务器API的完整列表:custom.metrics.k8s.io/v1beta1:服务器当前无法处理该请求,metrics.k8s.io/v1beta1:服务器当前无法处理该请求","原因": " DiscoveryFailed ","状态": " True ","类型":" NamespaceDeletionDiscoveryFailure " },{ " lastTransitionTime ":" 2022-10-20t 02:34:23Z ","消息":"所有旧的kube类型已成功解析","原因":" ParsedGroupVersions ","状态":" False ","类型":" " message ":"所有内容已成功移除"," reason": "ContentRemoved "," status": "False "," type ":" NamespaceContentRemaining " },{ " lastTransitionTime ":" 2022-10-20t 02:34:23Z "," message ":"所有content -保留终结器已完成"," reason ":" ContentHasNoFinalizers "," status": "False "," type:" " namespaceofinalizersremaining " }]," phase": "Terminating" }}清除规范和状态下的内容
以下是修改后的样式【供参考,与原json对比,以增加理解】
{ "apiVersion": "v1 "," kind": "Namespace "," metadata ":{ " annotations ":{ " application cnname ":" tool "," kubernetes . customized/bo cloud _ env _ id ":" 3 "," kubernetes . customized/bo cloud _ partition _ id ":" 172 "," kubernetes . customized/project _ creator ":" 7 "," kubernetes . customized/project _ id ":" 10 "," kubernetes . customized/tree _ application _ id ":" 10 " }," creation time stamp ":" 2000
当您打开代理服务时,您需要打开一个新的终端。打开的代理服务没有在后台运行,将占用一个终端。
当kubectl代理打开时,它将返回以下内容
127.0.0.1:8001开始服务
调用接口删除另一个可以操作命令的终端中的名称空间,执行下面的curl命令。
记得将tool.json -修改成自己的文件名tool/finalize -并将工具修改成自己的命名空间名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命令检查命名空间是否还存在。
关于k8s名称空间处于终止状态的解决方案,本文到此为止。关于k8s命名空间处于终止状态的更多信息,请搜索主机频道zhujipindao以前的文章。或者继续浏览下面的相关文章。希望大家支持主机频道zhujipindao。以后多来com!
评论前必须登录!
注册