无法删除 Kubernetes 中的 apache solr operator CRD

Unable to delete the apache solr operator CRD in Kubernetes

这里有一些有趣的东西,我正在努力弄清楚并寻求帮助。

我正在使用以下版本

Client Version: v1.21.2
Server Version: v1.20.7

我使用

安装了 apache solr 运算符
https://solr.apache.org/operator/downloads/crds/v0.3.0/all-with-dependencies.yaml

由于某些问题,我尝试通过删除命名空间本身来删除它。 (永远不要这样做!!)

现在我看到命名空间已删除,但自定义资源没有被删除。

kubectl get --show-kind solrclouds.solr.apache.org -n solr-wcnp-poc --v=6
I0905 14:21:39.593361   39140 round_trippers.go:454] GET https://oidc.us-dev-aks-ad-solrpoc.k8s.us.abcd.net/apis/solr.apache.org/v1beta1/namespaces/solr-wcnp-poc/solrclouds?limit=500 200 OK in 292 milliseconds
NAME                                VERSION   TARGETVERSION   DESIREDNODES   NODES   READYNODES   UPTODATENODES   AGE
solrcloud.solr.apache.org/explore   8.8.2                     1              1       0            1               7d19h

我也得到了全能 google 搜索的帮助,发现修补终结器可以解决问题。所以我尝试了同样的方法,但现在看到了一些有趣的东西!

kubectl patch solrcloud.solr.apache.org/explore -p '{"metadata":{"finalizers":[]}}' -n solr-wcnp-poc --type=merge --v=6

I0905 14:39:00.028568   55762 round_trippers.go:454] GET https://oidc.us-dev-aks-ad-solrpoc.k8s.us.abcd.net/apis/solr.apache.org/v1beta1/namespaces/solr-wcnp-poc/solrclouds/explore 200 OK in 343 milliseconds
I0905 14:39:00.335421   55762 round_trippers.go:454] PATCH https://oidc.us-dev-aks-ad-solrpoc.k8s.us.abcd.net/apis/solr.apache.org/v1beta1/namespaces/solr-wcnp-poc/solrclouds/explore?fieldManager=kubectl-patch 404 Not Found in 303 milliseconds
I0905 14:39:00.338733   55762 helpers.go:216] server response object: [{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {},
  "status": "Failure",
  "message": "namespaces \"solr-wcnp-poc\" not found",
  "reason": "NotFound",
  "details": {
    "name": "solr-wcnp-poc",
    "kind": "namespaces"
  },
  "code": 404
}]
F0905 14:39:00.339471   55762 helpers.go:115] Error from server (NotFound): namespaces "solr-wcnp-poc" not found

我的问题是, 如果 kubectl patch 命令无法找到命名空间,那么 kubectl get --showkind 为何显示已删除命名空间下的资源?

谁能帮我理解一下?

注意: 现在 k8s 集群不允许我删除 Solr-operator(kubectl delete 无限期挂起),如

customresourcedefinition.apiextensions.k8s.io "solrbackups.solr.apache.org" deleted
customresourcedefinition.apiextensions.k8s.io "solrclouds.solr.apache.org" deleted
customresourcedefinition.apiextensions.k8s.io "solrprometheusexporters.solr.apache.org" deleted
Warning: apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
customresourcedefinition.apiextensions.k8s.io "zookeeperclusters.zookeeper.pravega.io" deleted

^C

或者创建一个新的操作符(kubectl 说

customresourcedefinition.apiextensions.k8s.io/solrbackups.solr.apache.org created
customresourcedefinition.apiextensions.k8s.io/solrprometheusexporters.solr.apache.org created
Warning: apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
Error from server (AlreadyExists): error when creating "solr_operator.yaml": object is being deleted: customresourcedefinitions.apiextensions.k8s.io "solrclouds.solr.apache.org" already exists
Error from server (AlreadyExists): error when creating "solr_operator.yaml": object is being deleted: customresourcedefinitions.apiextensions.k8s.io "zookeeperclusters.zookeeper.pravega.io" already exists

我遇到了同样的问题,并通过重新创建命名空间和 运行

设法删除了自定义资源
kubectl patch solrcloud.solr.apache.org <NAME> -p '{"metadata":{"finalizers":[]}}' -n <RESTORED_NAMESPACE> --type=merge --v=6

相同的解决方案适用于我无法删除的自定义资源 perconaxtradbclusters.pxc.percona.com 和 zookeeperclusters.zookeeper.pravega.io