Istio -- 删除 istio-control-plane 进程被冻结

Istio -- Delete istio-control-plane Process Is Frozen

我试图按照以下步骤从 k8s 集群中卸载并重新安装 Istio:

但是我犯了一个错误,在删除istio-control-plane之前删除了命名空间:kubectl delete istiooperator istio-control-plane -n istio-system。然后当我再次尝试删除 istio-control-plane 时,它冻结了。

我尝试使用以下步骤删除终结器,但它说 Error from server (NotFound): istiooperators.install.istio.io "istio-control-plane" not found

kubectl get istiooperator -n istio-system -o json > output.json
nano output.json # and remove finalizer
kubectl replace --raw "/apis/install.istio.io/v1alpha1/namespaces/istio-system/istiooperators/istio-control-plane/finalize" -f output.json

这里是kubectl get istiooperator -n istio-system -o json的内容:

{
    "apiVersion": "v1",
    "items": [
        {
            "apiVersion": "install.istio.io/v1alpha1",
            "kind": "IstioOperator",
            "metadata": {
                "annotations": {
                    "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"install.istio.io/v1alpha1\",\"kind\":\"IstioOperator\",\"metadata\":{\"annotations\":{},\"name\":\"istio-control-plane\",\"namespace\":\"istio-system\"},\"spec\":{\"addonComponents\":{\"prometheus\":{\"enabled\":false},\"tracing\":{\"enabled\":false}},\"hub\":\"hub.docker.prod.walmart.com/istio\",\"profile\":\"default\",\"values\":{\"global\":{\"defaultNodeSelector\":{\"beta.kubernetes.io/os\":\"linux\"}}}}}\n"
                },
                "creationTimestamp": "2020-12-05T23:39:34Z",
                "deletionGracePeriodSeconds": 0,
                "deletionTimestamp": "2020-12-07T16:41:41Z",
                "finalizers": [
                ],
                "generation": 2,
                "name": "istio-control-plane",
                "namespace": "istio-system",
                "resourceVersion": "11750055",
                "selfLink": "/apis/install.istio.io/v1alpha1/namespaces/istio-system/istiooperators/istio-control-plane",
                "uid": "fda8ee4f-54e7-45e8-91ec-c328fad1a86f"
            },
            "spec": {
                "addonComponents": {
                    "prometheus": {
                        "enabled": false
                    },
                    "tracing": {
                        "enabled": false
                    }
                },
                "hub": "hub.docker.prod.walmart.com/istio",
                "profile": "default",
                "values": {
                    "global": {
                        "defaultNodeSelector": {
                            "beta.kubernetes.io/os": "linux"
                        }
                    }
                }
            },
            "status": {
                "componentStatus": {
                    "Base": {
                        "status": "HEALTHY"
                    },
                    "IngressGateways": {
                        "status": "HEALTHY"
                    },
                    "Pilot": {
                        "status": "HEALTHY"
                    }
                },
                "status": "HEALTHY"
            }
        }
    ],
    "kind": "List",
    "metadata": {
        "resourceVersion": "",
        "selfLink": ""
    }
}

关于如何手动卸载 istio-control-plane 有什么想法吗?

你可以使用下面的命令来更改和删除 istio operator finalizer,它是@Rico here 制作的 jq/kubectl oneliner。我也尝试过 kubectl patch 但它没有用。

kubectl get istiooperator -n istio-system istio-control-plane -o=json | \
jq '.metadata.finalizers = null' | kubectl apply -f -

另外我用过istioctl operator remove

istioctl operator remove
Removing Istio operator...
  Removed Deployment:istio-operator:istio-operator.
  Removed Service:istio-operator:istio-operator.
  Removed ServiceAccount:istio-operator:istio-operator.
  Removed ClusterRole::istio-operator.
  Removed ClusterRoleBinding::istio-operator.
✔ Removal complete

结果来自 kubectl get

kubectl get istiooperator istio-control-plane -n istio-system
Error from server (NotFound): namespaces "istio-system" not found