I installed a MYSQL Operator and a MYSQL InnoDB Cluster in deferent namespaces. Then I was about to delete both. It was successful for the MYSQL-Operator to delete. But I failed to delete the InnoDB Cluster. So I deleted each of the InnoDB Cluster components with force option. Some was successful but some was failed. So I tried to delete the namespace ifself with the last thing I could think of. But that ended up failure. It would be great that someone help me solve this problem. (Please let me know if you need more information.)
$ kubectl get namespace mycluster
mycluster Terminating 5d1h
$ kubectl get all -n mycluster
No resources found in mycluster namespace
$ kubectl get namespace mycluster
apiVersion: v1
kind: Namespace
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","kind":"Namespace","metadata":{"annotations":{},"creationTimestamp":null,"name":"mycluster"},"spec":{},"status":{}}
creationTimestamp: "2024-01-13T01:14:56Z"
deletionTimestamp: "2024-01-13T02:30:18Z"
labels:
kubernetes.io/metadata.name: mycluster
name: mycluster
resourceVersion: "5011759"
uid: a24383af-79b3-4e04-8ec0-fc049431d936
spec:
finalizers:
- kubernetes status: conditions:
- lastTransitionTime: "2024-01-13T02:30:25Z" message: All resources successfully discovered reason: ResourcesDiscovered status: "False" type: NamespaceDeletionDiscoveryFailure
- lastTransitionTime: "2024-01-13T02:30:25Z" message: All legacy kube types successfully parsed reason: ParsedGroupVersions status: "False" type: NamespaceDeletionGroupVersionParsingFailure
- lastTransitionTime: "2024-01-13T02:30:25Z" message: All content successfully deleted, may be waiting on finalization reason: ContentDeleted status: "False" type: NamespaceDeletionContentFailure
- lastTransitionTime: "2024-01-13T02:30:25Z" message: 'Some resources are remaining: innodbclusters.mysql.oracle.com has 1 resource instances' reason: SomeResourcesRemain status: "True" type: NamespaceContentRemaining
- lastTransitionTime: "2024-01-13T02:30:25Z" message: 'Some content in the namespace has finalizers remaining: mysql.oracle.com/cluster in 1 resource instances' reason: SomeFinalizersRemain status: "True" type: NamespaceFinalizersRemaining phase: Terminating
$ kubectl describe namespace mycluster
Name: argocd
Labels: kubernetes.io/metadata.name=argocd
Annotations: <none>
Status: Active
No resource quota.
No LimitRange resource.
Name: cert-manager Labels: kubernetes.io/metadata.name=cert-manager Annotations: <none> Status: Active
No resource quota.
No LimitRange resource.
Name: db-cluster Labels: kubernetes.io/metadata.name=db-cluster Annotations: <none> Status: Active
No resource quota.
No LimitRange resource.
Name: default Labels: kubernetes.io/metadata.name=default Annotations: <none> Status: Active
No resource quota.
No LimitRange resource.
Name: dev Labels: kubernetes.io/metadata.name=dev Annotations: <none> Status: Active
No resource quota.
No LimitRange resource.
Name: ingress-nginx Labels: kubernetes.io/metadata.name=ingress-nginx Annotations: <none> Status: Active
No resource quota.
No LimitRange resource.
Name: kube-node-lease Labels: kubernetes.io/metadata.name=kube-node-lease Annotations: <none> Status: Active
No resource quota.
No LimitRange resource.
Name: kube-public Labels: kubernetes.io/metadata.name=kube-public Annotations: <none> Status: Active
No resource quota.
No LimitRange resource.
Name: kube-system Labels: kubernetes.io/metadata.name=kube-system Annotations: <none> Status: Active
No resource quota.
No LimitRange resource.
Name: mycluster Labels: kubernetes.io/metadata.name=mycluster Annotations: <none> Status: Terminating Conditions: Type Status LastTransitionTime Reason Message
NamespaceDeletionDiscoveryFailure False Sat, 13 Jan 2024 11:30:25 +0900 ResourcesDiscovered All resources successfully discovered NamespaceDeletionGroupVersionParsingFailure False Sat, 13 Jan 2024 11:30:25 +0900 ParsedGroupVersions All legacy kube types successfully parsed NamespaceDeletionContentFailure False Sat, 13 Jan 2024 11:30:25 +0900 ContentDeleted All content successfully deleted, may be waiting on finalization NamespaceContentRemaining True Sat, 13 Jan 2024 11:30:25 +0900 SomeResourcesRemain Some resources are remaining: innodbclusters.mysql.oracle.com has 1 resource instances NamespaceFinalizersRemaining True Sat, 13 Jan 2024 11:30:25 +0900 SomeFinalizersRemain Some content in the namespace has finalizers remaining: mysql.oracle.com/cluster in 1 resource instances
No resource quota.
No LimitRange resource.
Name: mysql-operator Labels: kubernetes.io/metadata.name=mysql-operator Annotations: <none> Status: Active
No resource quota.
No LimitRange resource.
Name: redis Labels: kubernetes.io/metadata.name=redis Annotations: <none> Status: Active
No resource quota.
No LimitRange resource.
I tried to delete the namespace in many ways.
Solved.
I patched crd's finalizers.