我想删除命名空间及其下的所有资源。
所以我跑了
% kubectl delete namespace observability
namespace "observability" deleted但是这个命令被卡住了,当我检查它显示的名称空间状态时,它显示了Terminating
$ kubectl get ns
NAME STATUS AGE
observability Terminating 14h
odigos-system Terminating 14h然后我尝试按提到的这里步骤删除它
此命令没有返回任何结果kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get --show-kind --ignore-not-found -n observability,因此将其杀死。
然后我尝试手动删除一个终止名称空间。
但是按照命令返回
% curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json http://127.0.0.1:8001/api/v1/namespaces/observability/finalize
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {
},
"status": "Failure",
"message": "the object provided is unrecognized (must be of type Namespace): couldn't get version/kind; json parse error: invalid character 'a' looking for beginning of value (61706956657273696f6e3a2076310a6b696e643a204e616d657370616365 ...)",
"reason": "BadRequest",
"code": 400
}%以下是命名空间定义
kubectl get ns observability -o yaml
apiVersion: v1
kind: Namespace
metadata:
creationTimestamp: "2022-09-20T02:25:56Z"
deletionTimestamp: "2022-09-20T15:04:26Z"
labels:
kubernetes.io/metadata.name: observability
name: observability
name: observability
resourceVersion: "360388862"
uid: 8cef9b90-af83-4584-b26e-8aa89212b80c
spec:
finalizers:
- kubernetes
status:
conditions:
- lastTransitionTime: "2022-09-20T15:04:31Z"
message: 'Discovery failed for some groups, 1 failing: unable to retrieve the
complete list of server APIs: metrics.k8s.io/v1beta1: an error on the server
("Internal Server Error: \"/apis/metrics.k8s.io/v1beta1?timeout=32s\": the server
could not find the requested resource") has prevented the request from succeeding'
reason: DiscoveryFailed
status: "True"
type: NamespaceDeletionDiscoveryFailure
- lastTransitionTime: "2022-09-20T15:04:32Z"
message: All legacy kube types successfully parsed
reason: ParsedGroupVersions
status: "False"
type: NamespaceDeletionGroupVersionParsingFailure
- lastTransitionTime: "2022-09-20T15:05:43Z"
message: All content successfully deleted, may be waiting on finalization
reason: ContentDeleted
status: "False"
type: NamespaceDeletionContentFailure
- lastTransitionTime: "2022-09-20T15:05:43Z"
message: All content successfully removed
reason: ContentRemoved
status: "False"
type: NamespaceContentRemaining
- lastTransitionTime: "2022-09-20T15:04:32Z"
message: All content-preserving finalizers finished
reason: ContentHasNoFinalizers
status: "False"
type: NamespaceFinalizersRemaining
phase: Terminating我将这些名称空间放在这个https://medium.com/@edeNFed/how-to-build-an-end-to-end-open-source-observability-solution-on-kubernetes-c8725c016dd5之后
我正在使用下面的版本
% kubectl version --short
Client Version: v1.23.6
Server Version: v1.22.12-eks-6d3986b我怎么才能解决这个问题?
发布于 2022-09-20 18:26:01
看来您的度量标准--服务器出现了问题。检查它是否向上,并尝试解决这个根本原因kubectl -n kube-system get pods | grep metrics-server。有关更多信息,请参见https://github.com/kubernetes-sigs/metrics-server
https://stackoverflow.com/questions/73790586
复制相似问题