kubernetes: Deleting ns is stuck on terminating
What happened?
I started to execute kubectl delete ns xxx without clearing the resources under the namespace, and found that the namespace was stuck in the terminating state.
[root@k8s-master-node1 lstio]# kubectl get ns pal -ojson
{
“apiVersion”: “v1”,
“kind”: “Namespace”,
“metadata”: {
“annotations”: {
“cattle.io/status”: “{"Conditions":[{"Type":"ResourceQuotaInit","Status":"True","Message":"","LastUpdateTime":"2024-01-22T06:13:19Z"},{"Type":"InitialRolesPopulated","Status":"True","Message":"","LastUpdateTime":"2024-01-22T06:13:19Z"}]}”,
“kubectl.kubernetes.io/last-applied-configuration”: “{"apiVersion":"v1","kind":"Namespace","metadata":{"annotations":{"cattle.io/status":"{\"Conditions\":[{\"Type\":\"ResourceQuotaInit\",\"Status\":\"True\",\"Message\":\"\",\"LastUpdateTime\":\"2024-01-22T06:13:19Z\"},{\"Type\":\"InitialRolesPopulated\",\"Status\":\"True\",\"Message\":\"\",\"LastUpdateTime\":\"2024-01-22T06:13:19Z\"}]}","lifecycle.cattle.io/create.namespace-auth":"true"},"creationTimestamp":"2024-01-22T06:13:18Z","finalizers":["controller.cattle.io/namespace-auth"],"managedFields":[{"apiVersion":"v1","fieldsType":"FieldsV1","fieldsV1":{"f:status":{"f:phase":{}}},"manager":"kubectl-create","operation":"Update","time":"2024-01-22T06:13:18Z"},{"apiVersion":"v1","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:cattle.io/status":{},"f:lifecycle.cattle.io/create.namespace-auth":{}},"f:finalizers":{".":{},"v:\"controller.cattle.io/namespace-auth\"":{}}}},"manager":"rancher","operation":"Update","time":"2024-01-22T06:13:18Z"}],"name":"pal","resourceVersion":"24742810","uid":"8ab8b99b-8eab-4657-9902-87af861f6fba"},"status":{"phase":"Active"}}\n”,
“lifecycle.cattle.io/create.namespace-auth”: “true”
},
“creationTimestamp”: “2024-02-28T02:20:50Z”,
“deletionGracePeriodSeconds”: 0,
“deletionTimestamp”: “2024-05-24T06:01:07Z”,
“finalizers”: [
“controller.cattle.io/namespace-auth”
],
“managedFields”: [
{
“apiVersion”: “v1”,
“fieldsType”: “FieldsV1”,
“fieldsV1”: {
“f:metadata”: {
“f:annotations”: {
“.”: {},
“f:cattle.io/status”: {},
“f:kubectl.kubernetes.io/last-applied-configuration”: {},
“f:lifecycle.cattle.io/create.namespace-auth”: {}
},
“f:finalizers”: {
“.”: {},
“v:"controller.cattle.io/namespace-auth"”: {}
}
}
},
“manager”: “kubectl-client-side-apply”,
“operation”: “Update”,
“time”: “2024-02-28T02:20:50Z”
},
{
“apiVersion”: “v1”,
“fieldsType”: “FieldsV1”,
“fieldsV1”: {
“f:status”: {
“f:phase”: {}
}
},
“manager”: “kube-controller-manager”,
“operation”: “Update”,
“time”: “2024-05-24T06:01:12Z”
}
],
“name”: “pal”,
“resourceVersion”: “10993707”,
“uid”: “e8dae028-edcf-461d-97c6-5b71ef4621ff”
},
“spec”: {},
“status”: {
“conditions”: [
{
“lastTransitionTime”: “2024-05-24T06:01:12Z”,
“message”: “All resources successfully discovered”,
“reason”: “ResourcesDiscovered”,
“status”: “False”,
“type”: “NamespaceDeletionDiscoveryFailure”
},
{
“lastTransitionTime”: “2024-05-24T06:01:12Z”,
“message”: “All legacy kube types successfully parsed”,
“reason”: “ParsedGroupVersions”,
“status”: “False”,
“type”: “NamespaceDeletionGroupVersionParsingFailure”
},
{
“lastTransitionTime”: “2024-05-24T06:01:12Z”,
“message”: “All content successfully deleted, may be waiting on finalization”,
“reason”: “ContentDeleted”,
“status”: “False”,
“type”: “NamespaceDeletionContentFailure”
},
{
“lastTransitionTime”: “2024-05-24T06:01:12Z”,
“message”: “All content successfully removed”,
“reason”: “ContentRemoved”,
“status”: “False”,
“type”: “NamespaceContentRemaining”
},
{
“lastTransitionTime”: “2024-05-24T06:01:12Z”,
“message”: “All content-preserving finalizers finished”,
“reason”: “ContentHasNoFinalizers”,
“status”: “False”,
“type”: “NamespaceFinalizersRemaining”
}
],
“phase”: “Terminating”
}
}
I tried to modify the spec.finalizers using kube-proxy, but the spec field is empty.
What did you expect to happen?
namespace was deleted
How can we reproduce it (as minimally and precisely as possible)?
kubectl delete ns xxxx
Anything else we need to know?
No response
Kubernetes version
$ kubectl version
# paste output here
Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.15", GitCommit:"8f1e5bf0b9729a899b8df86249b56e2c74aebc55", GitTreeState:"clean", BuildDate:"2022-01-19T17:27:39Z", GoVersion:"go1.15.15", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.15", GitCommit:"8f1e5bf0b9729a899b8df86249b56e2c74aebc55", GitTreeState:"clean", BuildDate:"2022-01-19T17:23:01Z", GoVersion:"go1.15.15", Compiler:"gc", Platform:"linux/amd64"}
Cloud provider
OS version
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
[root@k8s-master-node1 lstio]# uname -a
Linux k8s-master-node1 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
[root@k8s-master-node1 lstio]#
# paste output here
# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, …) and versions (if applicable)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (10 by maintainers)
Ok, thanks.i understand,now how can i fix it ?
No, I mean some controller that seems to come from rancher is adding a finalizer
controller.cattle.ioand not removing it, so this leaves the namespce stuckit seems to be handled by rancher controller, it is better you open the issue in the Rancher project
/close