kubesphere / helm-charts

Source & Repo of https://charts.kubesphere.io/main & https://charts.kubesphere.io/test
100 stars 180 forks source link

Kubesphere uninstall script has to be improved- gets stuck in host cluster uninstallation #235

Open KR411-prog opened 2 years ago

KR411-prog commented 2 years ago

Kubesphere uninstall script has to be improved. https://github.com/kubesphere/ks-installer/blob/master/scripts/kubesphere-delete.sh

when I tried to run uninstall on Kubesphere host cluster, it is stuck in Kube-federation-system with terminating status. And I have to manually clean up by removing finalizers.

kubectl get namespaces

NAME STATUS AGE

add-ons Active 17d

apicentral Active 17d

default Active 17d

kube-federation-system Terminating 101m

This does not seem to happen in member cluster

Ideally helm uninstall should be able to remove all the resources deployed in Kubesphere. But it only deletes crd clusterconfiguration. So we have to run this script manually for uninstall.

KR411-prog commented 2 years ago

After running the uninstall script in Kubesphere host cluster, I find the below resources not deleted.

kubectl api-resources --verbs=list --namespaced -o name | grep -v event | xargs -n 1 kubectl get --show-kind --ignore-not-found -n "kube-federation-system" NAME AGE federatedtypeconfig.core.kubefed.io/applications.app.k8s.io 17d federatedtypeconfig.core.kubefed.io/clusterrolebindings.rbac.authorization.k8s.io 17d federatedtypeconfig.core.kubefed.io/clusterroles.rbac.authorization.k8s.io 17d federatedtypeconfig.core.kubefed.io/configmaps 17d federatedtypeconfig.core.kubefed.io/configs.notification.kubesphere.io 17d federatedtypeconfig.core.kubefed.io/deployments.apps 17d federatedtypeconfig.core.kubefed.io/globalrolebindings.iam.kubesphere.io 17d federatedtypeconfig.core.kubefed.io/globalroles.iam.kubesphere.io 17d federatedtypeconfig.core.kubefed.io/groupbindings.iam.kubesphere.io 17d federatedtypeconfig.core.kubefed.io/groups.iam.kubesphere.io 17d federatedtypeconfig.core.kubefed.io/ingresses.networking.k8s.io 17d federatedtypeconfig.core.kubefed.io/jobs.batch 17d federatedtypeconfig.core.kubefed.io/limitranges 17d federatedtypeconfig.core.kubefed.io/namespaces 17d federatedtypeconfig.core.kubefed.io/persistentvolumeclaims 17d federatedtypeconfig.core.kubefed.io/receivers.notification.kubesphere.io 17d federatedtypeconfig.core.kubefed.io/replicasets.apps 17d federatedtypeconfig.core.kubefed.io/secrets 17d federatedtypeconfig.core.kubefed.io/serviceaccounts 17d federatedtypeconfig.core.kubefed.io/services 17d federatedtypeconfig.core.kubefed.io/statefulsets.apps 17d federatedtypeconfig.core.kubefed.io/users.iam.kubesphere.io 17d federatedtypeconfig.core.kubefed.io/workspacerolebindings.iam.kubesphere.io 17d federatedtypeconfig.core.kubefed.io/workspaceroles.iam.kubesphere.io 17d federatedtypeconfig.core.kubefed.io/workspaces.tenant.kubesphere.io 17d Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress

I tried to delete them one after the other but its getting stuck in deletion. kubectl delete federatedtypeconfig.core.kubefed.io/applications.app.k8s.io -n kube-federation-system - is stuck in deletion

kubectl describe federatedtypeconfig.core.kubefed.io/applications.app.k8s.io -n kube-federation-system Name: applications.app.k8s.io Namespace: kube-federation-system Labels: Annotations: API Version: core.kubefed.io/v1beta1 Kind: FederatedTypeConfig Metadata: Creation Timestamp: 2022-04-29T21:07:52Z Deletion Grace Period Seconds: 0 Deletion Timestamp: 2022-05-15T17:57:06Z Finalizers: core.kubefed.io/federated-type-config Generation: 2 Managed Fields: API Version: core.kubefed.io/v1beta1 Fields Type: FieldsV1 fieldsV1: f:metadata: f:annotations: .: f:kubectl.kubernetes.io/last-applied-configuration: f:spec: .: f:federatedType: .: f:group: f:kind: f:pluralName: f:scope: f:version: f:propagation: f:targetType: .: f:group: f:kind: f:pluralName: f:scope: f:version: Manager: kubectl Operation: Update Time: 2022-04-29T21:07:52Z API Version: core.kubefed.io/v1beta1 Fields Type: FieldsV1 fieldsV1: f:metadata: f:finalizers: .: v:"core.kubefed.io/federated-type-config": f:status: .: f:observedGeneration: f:propagationController: f:statusController: Manager: controller-manager Operation: Update Time: 2022-04-29T21:08:06Z Resource Version: 10862468 UID: 3674d821-12e1-454a-a35d-4945f5c436ac Spec: Federated Type: Group: types.kubefed.io Kind: FederatedApplication Plural Name: federatedapplications Scope: Namespaced Version: v1beta1 Propagation: Enabled Target Type: Group: app.k8s.io Kind: Application Plural Name: applications Scope: Namespaced Version: v1beta1 Status: Observed Generation: 1 Propagation Controller: Running Status Controller: NotRunning Events: